Trying to plot a high chart dynamically using Angular JS. I have two lines I want to plot on the same graph.
Example item in the 'jsondata':
{
"ID": 123456,
"SaleDate": "2016-02",
"SalesAgeBucket5": "NULL",
"SalesAgeBucket10": 19300000,
"SalesAgeBucket15": "NULL",
"SalesAgeBucket20": "NULL",
"SalesAgeBucket25": "NULL"
}
In the high chart config file the name is being applied in the series but not within the data attribute. So SalesAgeBucket5 is plotted with all the data but it is not being grouped. I am only seeing one line with all the data plotted against that series.
$scope.chartConfig.series[0].name = "SalesAgeBucket5";
$scope.chartConfig.series[0].data = jsondata.map(item => item["SalesAgeBucket5"]);
$scope.chartConfig.series[1].name = "SalesAgeBucket10";
$scope.chartConfig.series[1].data = jsondata.map(item => item["SalesAgeBucket10"]);
$scope.chartConfig.xAxis.categories = jsondata.map(item => item[Object.keys(jsondata[0].SaleDate)]);
> angular.min.js:124 TypeError: Cannot set property 'name' of undefined at b.$scope.getData (main.js:25699) at fn (eval at compile (angular.min.js:242), <anonymous>:4:141) at e (angular.min.js:288) at b.$eval (angular.min.js:151) at b.$apply (angular.min.js:151) at HTMLSpanElement.<anonymous> (angular.min.js:288) at HTMLSpanElement.dispatch (jquery.min.js:3) at HTMLSpanElement.v.handle (jquery.min.js:3)
Output of high chart config:
{
"chart":{
},
"plotOptions":{
"line":{
"dataLabels":{
"enabled":false
},
"enableMouseTracking":true
}
},
"series":[
{
"data":["null","null",140000,"null" etc... INCLUDES ALL VALUES],
"id":"Results1",
"turboThreshold":0,
"name":"SalesAgeBucket5"
}
],
"xAxis":{
"categories":""
},
"title":{
"text":"Sales & Purchase"
}
}
but I am expecting multiple line charts on this graph therefore multiple data attributes