You must be logged in to post your query.
Home › Forums › Chart Support › how to get min/max of graph in react?
https://stackblitz.com/edit/canvasjs-chart-tooltip-to-stripline-v8r5l7?file=src%2FApp.jsx
I am trying to set a stripline to set the background of the plot area but I am having having trouble knowing how to get the min, max and rerendering the chart in react
@scompliance,
You can get the axis properties like minimum, maximum, etc. in useEffect hook as show in the code-snippet below.
useEffect(() => { chart.axisX[0].addTo('stripLines', { startValue: chart.axisX[0].get('minimum'), endValue: chart.axisX[0].get('maximum'), color: 'rgba(221, 160, 221, 0.1)', }); }, []);
You can add stripline as plotarea background once you have access to axis range properties. Please take a look at this Stackblitz for an example of the same.
— Vishwas R Team CanvasJS
You must be logged in to reply to this topic. Login/Register