0

I'm new to react and i'm integrating react-chartjs-2 to populate my data on the chart.

I'm using Bar chart to show the success and failure calls

1.)In the constructor i'm setting the parameters required for the chart to display setting for chartjs

2.)Next, I'm making a call with the server and fetching the data to form the X axis(date) .date params

On YAxis i wanted only two ticks 0(fail) and 200(success) but there chartjs doing 20 step sizing.YAxis and XAxis is not appearing as it should only current time is appearing on the XAxis

Please help, anything will do good.

Thanks

1 Answers1

0

Finally found the solution!

After a lot of debugging :-

1.) I removed all of the options for Xaxis that started giving me the time on xAxis. 2.) While setting datasets in the setState, data field is set to array of chartdata. i just removed the data array from (data:[chartdata] to data:chartdata), see the image this solved my problem.

While intializing chartdata in the function i set it to array and when i'm putting it to data field again i'm setting it to the array that where my problem was lying.

Hope if anyone is getting this kind of problem will get help from this response.Thanks!