1👍
Just send the arrays to the browser using
echo json_encode( $data );
You would probably want to store that in a hidden field somewhere. After the page is loaded kick off the JS to actually load the charts. I am not very familiar with PhP or ChartJS but this seems like the standard way to pass data from the server to the browser. If I missed the mark and didn’t answer your question feel free to ask a follow up and ill do my best to help out.
- Chartjs-Create data in data with Chartjs
- Chartjs-ChartJS Line Chart – Points Connected out of order for Timeseries in Angular 6
Source:stackexchange.com