I have an angular2-highcharts chart. I want to highlight select lines of a data series based on which line is clicked. I am using the following piece of code to do so and I get an error saying
Cannot read property 'series' of undefined.
I have my series predefined, it has name, data, color and width elements.
this.options={
title : { text : 'Sample' },
legend:{enabled:false},
plotOptions:{
series:{
events:{
mouseOver:function(){
var m=this.series.options.id;
var abc=series;
var new_series=[];
for(var i=0;i<abc.length;i++)
{abc[i].color='black';}
abc[m].color='red';
for(var i=0;i<chart.series.length;i++)
{chart.series[i].remove();
new_series.push({name:abc[i].name,data:abc[i].data,color:abc[i].color})
}
chart.addSeries(new_series,false);
chart.redraw();
}
}
},
},
series:series,
xAxis:{title:{text:'X'}},
yAxis:{title:{text:'Y'}},
}
$('#conatainer').highcharts(this.options)
var chart=$('#conatainer').highcharts();
I am guessing the error is in the way the chart has been referenced. I was not sure how to reference it in typescript and looked up a few examples in java script to do so.
It would very helpful to know how to correct this.