
- React / Next.js
- HTML (coming soon)
1
Import components from Highcharts
2
Import Comment components from Velt
- Add
VeltCommentsonce to the root of your app. This component is required to render comments in your app.
3
Create a ref for the HighchartsReact component
- Create a
refand pass it into therefproperty of theHighchartsReactcomponent. - This ref object will be used by Velt to get the Chart data and add comment pin to it.
4
Add a container div for the HighchartsReact component
- Give it a
position: relativestyle. This will help position the Velt Comment Pins accurately.
5
Add VeltHighChartComments component in the same container
- Conditionally render
VeltHighChartsCommentsin the same container div as theHighchartsReactcomponent. - Set a unique
idin the VeltHighChartsComments component to scope comments to the specific chart, isolating them from other charts. - Pass the
chartComputedDataprop with therefyou created earlier.
6
(Optional) Customize the Chart Metadata displayed in the Comment Dialog
- Pass an array to the
dialogMetadataTemplateprop in the VeltHighChartsComments component. - This array determines the chart metadata displayed in the comment dialog, representing the data point (e.g., x-axis and y-axis values) on which the comment was added.
- Customize the order of the keys or remove unnecessary keys to control how the metadata is presented in the comment dialog.
Default: ['groupId', 'label', 'value']For example:
