You must be logged in to post your query.
Home › Forums › Chart Support › json file
Tagged: dynamic, JSON
I wanted to make a dropdown list, when a user clicks on the drop down, it will show the charts.
This is my website. http://fkiattendance.xyz/staff_report.php
But the charts doesnt come out. it shows in the json_encode.
staff_report.php <script type=”text/javascript”> window.onload = function () { var chart = new CanvasJS.Chart(“chartContainer”,{ title:{ text:”Attendance” }, data: [{ type: “column”, dataPoints : [], }] });
$.getJSON(“report.php?type=”+TME2073, function(data) { $.each((data), function(key, value){ chart.options.data[0].dataPoints.push({label: new Date(value[0]), y: parseInt(value[1])});
}); chart.render(); updateChart(); });
function updateChart() { $.getJSON(“report.php?type=”+TME2073, function(data) { chart.options.data[0].dataPoints = []; chart.options.data[1].dataPoints = []; $.each((data), function(key, value){ chart.options.data[0].dataPoints.push({label: new Date(value[0]), y: parseInt(value[1])});
});
chart.render(); }); }
setInterval(function(){updateChart()}, 1000); } </script>
@natasha11,
It seems like dataPoints are not being updated properly.
Can you kindly share the sample project with sample JSON over google-drive or onedrive so that we can understand it better and help you out?
— Vishwas R Team CanvasJS
You must be logged in to reply to this topic. Login/Register