import { ResponsiveLine } from '@nivo/line';
import { VeltNivoChartComments } from '@veltdev/react';
import { useState } from 'react'
function YourComponent() {
const [data, setData] = useState(CHART_DATA);
return (
// add nivo-chart-container class to the parent element of your NivoChart
<div style={{ height: 400, width: '100%' }} className='nivo-chart-container'>
<ResponsiveLine
data={data}
layers={[
'grid', 'markers', 'axes', 'areas', 'crosshair',
'lines', 'slices', 'legends', 'points',
// Add this function with VeltNivoChartComments
// component to allow Velt comments inside Chart
(chartComputedData) => {
return (
<VeltNivoChartComments id="NivoLineChartExample" chartComputedData={chartComputedData} dialogMetadataTemplate={['label', 'value', 'groupId']} />
)
}
]}
/>
</div>
)
}