Chartjs-My ChartJS Line needs to click the color legend first before it plots the data

0👍

Data is called as a function.
Make data as a state Object variable. like {"chart_PH":[], "chart_Dissolve":[]}
and set them using the function.

add your data variable inside your useEffect dependency array. For Ex: From [] to [data].
[] in dependency means, it will load only on the first render. [data] means, it will render every time the data changes.

Leave a comment