Is there a way to pass an array of objects to canvasJS? I am trying to include this array as part of a more complex object that is passed from PHP to a JS script. Here is my current approach:
var active_alarms_data = JSON.parse('<?php echo json_encode($activePriceAlarms,JSON_NUMERIC_CHECK);?>');
I also attempted:
var active_alarms_data = <?php echo json_encode($activePriceAlarms,JSON_NUMERIC_CHECK);?>;
Here is the structure of the main object:
https://i.sstatic.net/27cNq.png
The chart data can be found in the sub-array factory_made_avg_graph_prices_stats. While printing the entire object to the console, it seems that this field is correctly formatted as an array with 104 elements indexed from 0 to 103. This is what I need! However, when I try to access the array directly, I encounter something unexpected:
console.log("ELEMENT 0: " + active_alarms_data[i].graph.factory_made_avg_graph_prices_stats);
The output is different and the chart remains empty. It appears that the expected data format may not match the previous one. Any suggestions on how to resolve this issue?