How can I add angular 2 click event to high chart with chart type as bar? I am trying to use using code below:
let chart = new highCharts.Chart('container', Class1.createBarChart());
chart.series.click = this.clickBars();
clickBars() {
console.log('bar clicked');
}
I don't want to use <chart>
directives because of technical limitations.
Also I don't want to call click event in high charts configuration object.
Please let me know appropriate solution for it.
EDITED:
I have tried below code based on suggestion:
chart.options.plotOptions.series.point.events.click = (function(event) { this.clickBars(event) }).bind(this);
But here this.clickBars is coming as undefined. Though I have created a function in my class.
If I am using code like:
chart.options.plotOptions.series.point.events.click = (event) => this.clickBars(event);
Then it is returning 'Illegal return statements'.