I am trying to use Google Charts and populate it using external JSON file, which I have created in PHP via json_encode().
So I got google charts working, with static random data from example, which is:
function drawChart() {
var data = google.visualization.arrayToDataTable([
['Time', 'Temperature', 'Humidty'],
['2018-03-09 13:28:49', 1000, 400],
['2018-03-09 13:28:59', 1170, 460],
['2018-03-09 14:28:49', 660, 1120],
['2018-03-09 17:28:49', 1030, 540],
['2018-03-09 13:28:49', 1030, 540]
]);
So basically as I understand var data should be replaced with entries from my JSON file, which is formatted in the following manner:
[{"id":"1","temp":"24.40","hum":"28.30","insert_date":"2018-03-09 13:28:49"},{"id":"2","temp":"24.50","hum":"28.60","insert_date":"2018-03-09 13:29:59"}]
So the data I need would be temp, hum and insert date. So, the question is how do I parse it?
I've been trying for hours and haven't been able to figure it out.
Thanks