Home Forums Chart Support how to get min/max of graph in react? Reply To: how to get min/max of graph in react?

#45682

@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.

Stripline as Plotarea Background in React Chart


Vishwas R
Team CanvasJS