[Chartjs]-How to plot a line chart in ChartJS?

2๐Ÿ‘

โœ…

I have updated the jsfiddle with following changes and it is working.

In the script

var data = [{"profit": 345}, {"profit":-4}, {"profit":58}, {"profit": -30}];
//or you can use
var data = [{"profit": 4}, {"profit":2}, {"profit":-3}, {"profit": -5}];

populateChartData(data);

and added the Chart library as external resource that you can see as well. Then

Also i had added the canvas to the html

<canvas id="niftyTrackerChart" width="800" height="400"></canvas>

Updated JSFiddle Link
http://jsfiddle.net/muasif80/zkrh7/156/

Have a look at this link How to uses numbers array for line chart?

This is saying if you are only using numbers then you have to define a labels array too for the x-axis.

Leave a comment