Chartjs-Not being able to display value from json data into chart js

0👍

In componentDidMount() you can update state variable chartData as

this.setState({
   isLoaded: true,
   items: json,
   chartData: {
     labels: symbolsdate,
     datasets: [{...this.state.chartData.datasets, data: closingprice}]
   }
});

Better is to separate dynamic part from static. Store static data like backgroundColor outside of state & provide statically in HTML of render() while, use state variables for dynamic data.

Leave a comment