I am generating such an array in php with json nested in an 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 to access chartDatajson inside this array and insert it into the HighCharts series .
I tried using:
window['chart' + chartData.id].series[0].addPoint(chartData, true, shift);
as well as the loop forEach:
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 do not display errors in the console, and the values ββdo not appear on the chart. If I console.log(dataPoint);get what looks like the correct output:
[[1470406561000,2116],[1470406561000,2116],[1470406562000,2116]]
How to insert chartDatajson into the highchart series ?
source
share