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

how to get min/max of graph in react?

Viewing 2 posts - 1 through 2 (of 2 total)
  • #45677

    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

    #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

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.