Hi chorn, thanks for the reply…Yes i did what you said and I am able to display those values using
echo json_encode($r1, JSON_NUMERIC_CHECK);…But my question is how do i pass these values to the x: dataPoints in javascript canvas.js as shown in the below code…
<script type="text/javascript">
window.onload = function() {
var dps = [{x: "HOW DO I GET THE VALUES WHICH I HAVE RECEIVED IN PHP using echo json_encode() HERE", y: "20"}];
var chart = new CanvasJS.Chart("chartContainer", {
title: {
text: "Line Chart"
},
axisX: {
interval: 1,
title: "Time",
//valueFormatString: "hh:mm TT",
},
axisY: {
interval: 5,
title: "Temp"
},
data: [{
type: "line",
dataPoints: dps///////(HERE I AM GETTING THE VALUES OF x and y THROUGH THE VARIABLE dps)...
}]
});
chart.render();
}
</script>
<script src="canvasjs.min.js"></script>