Hi,
CanvasJs Expects the value to be integer – stings are not parsed automatically. So you’ll have to parse y values before assigning. Below is how you can do the same.
$(document).ready(function () {
var dataPoints = [];
$.getJSON("data1.php", function (result) {
for(var i = 0; i <= result.length-1; i++) {
dataPoints.push({label: result[i].label, y: parseInt(result[i].y)});
}
var chart = new CanvasJS.Chart("chartContainer", {
data: [
{
dataPoints: dataPoints
}
]
});
chart.render();
});
});
__
Anjali