0👍
You shout assign php variables to js variables and work with them.
Something like this
var data = '<?php echo json_encode($readingArray); ?>';
Then convert json string to object
arrayOfObjects = JSON.parse(data)
After that iterate your data and print chart
for (var key in arrayOfObjects) {
console.log(arrayOfObjects[key])
}
- Chartjs-Unable to change size of Chart.js
- Chartjs-JavaScript. Find the sum of a certain parameter in an array to produce a popup if that sum == 0
Source:stackexchange.com