I generate an array like so in php with json nested in the array under chartData:
array:1 [▼
0 => array:18 [▼
"id" => 1
"chart_title" => "A title"
"chart_type" => "line"
"chartData" => "[[1470406561000,2116],[1470406561000,2116],[1470406562000,2116]]"
]
]
I want access the chartData json within this array and insert it into a HighCharts series.
I've tried using:
window['chart' + chartData.id].series[0].addPoint(chartData, true, shift);
and also a forEach loop:
chartData.forEach(function(dataPoint){
console.log(dataPoint);
window['chart' + chartData.id].series[0].addPoint(dataPoint[0], true);
dataPoint.slice(0,30).forEach(function(point){
window['chart' + chartData.id].series[0].addPoint(point, true, shift);
});
});
Both don't show any errors in the console and the values don't show up on the chart. If I console.log(dataPoint); I get what looks like the correct output:
[[1470406561000,2116],[1470406561000,2116],[1470406562000,2116]]
How would I insert the chartData json into a highchart series?