Home Forums Chart Support Chart dont get mysql data using json file, need to run json file first Reply To: Chart dont get mysql data using json file, need to run json file first

#20515

http://fkiattendance.xyz/staff_report.php

this is the link to my chart.

<script type=”text/javascript”>
window.onload = function () {
var chart = new CanvasJS.Chart(“chartContainer”,{
title:{
text:”Rendering Multi Series Chart from database”
},
data: [{
type: “column”,
dataPoints : [],
}]
});

$.getJSON(“report.php”, function(data) {
$.each((data), function(key, value){
chart.options.data[0].dataPoints.push({label: value[0], y: parseInt(value[1])});
});
chart.render();
updateChart();
});

function updateChart() {
$.getJSON(“report.php”, function(data) {
chart.options.data[0].dataPoints = [];
chart.options.data[1].dataPoints = [];
$.each((data), function(key, value){
chart.options.data[0].dataPoints.push({label: value[0], y: parseInt(value[1])});
});

chart.render();
});
}

setInterval(function(){updateChart()}, 1000);
}
</script>

it still wont come render.