Chartjs-Pass array to chart.js option

1👍

This is how I fixed it: I pass my rgba array to the "backgroundColor" option in Chart.js with this string:

backgroundColor: <?php echo json_encode($ColorArray); ?>,

and now it works.

My mistake was in passing the php variable directly to the backgroundColor option of chart.js like this:

backgroundColor: $ColorArray,

Leave a comment