Home forums Using CanvasJS Fetch data from Codeigniter Reply To: Fetch data from Codeigniter

#26832

@zeffry,

You can try parsing the data from newdataPoints array into a new array in CanvasJS acceptable format. As shown in the below code snippet.

var dps = [];
for(var i = 0; i < newdataPoints.length; i++) {
dps.push({ label: newdataPoints[i].nama_kategori, y: newdataPoints[i].jumlah_berita });
} 

Further, using the dps array to define the chart option dataPoints like dataPoints: dps should work fine in your case.


Shashi Ranjan
Team CanvasJS