Home forums Using CanvasJS using json array from php json_encode Reply To: using json array from php json_encode


Using https://canvasjs.com/php-charts/dynamic-live-multi-series-chart/ as reference, this is what i came up with:
This is my JSON array:
[{“ID”:6,”Date”:”2020-01-24 07:35:46″,”sensorName”:”sensor 1″,”sensorValue”:213},{“ID”:7,”Date”:”2020-01-24 07:35:46″,”sensorName”:”sensor 1″,”sensorValue”:433},{“ID”:8,”Date”:”2020-01-24 07:35:46″,”sensorName”:”sensor 2″,”sensorValue”:45},{“ID”:9,”Date”:”2020-01-24 07:35:46″,”sensorName”:”sensor 3″,”sensorValue”:54}]

Im not sure how to retrieve data (Date, sensorName, sensorValue) from the JSON array.
For the graph, the x-axis will be the Date value from the JSON array. the y-axis will have values from the sensorValue. the graph should only show the latest 50 data points from the JSON array. the graph updates every 2 secs.