I tried to add new value to a pre-defined array of object like this:
$scope.chartConfig.series.push(
[{
name: "Brands",
colorByPoint: true,
data: []
}]
);
I want to add a new array value like so to data but keep failing. I've tried:
$scope.todayChartConfig.series['data'] = [];
$scope.todayChartConfig.series['data'].push(
{
name: "Internet Explorer",
y: 56.33
},
{
name: "Chrome",
y: 30.12
}
);
But it append to a new object instead of combine with the current data array.
What I expect is:
[{
name: "Brands",
colorByPoint: true,
data: [
{
name: "Internet Explorer",
y: 56.33
},
{
name: "Chrome",
y: 30.12
}
]
}]
How can I achieve that?
$scope.todayChartConfig.series[0][0].data.push(...)but I'm not sure if you really intended that 2D arrayseriesproperty is an array of arrays of objects. But in your second example,seriesappears to be an object that you're trying access a property on.