I'm having difficulty hand-rolling a solution involving adding a click listener to an X-Axis label (specifically a column chart) from the HighCharts API, specifically within an Angular 2+ application.
I know the following thus far:
- I'm using angular2-highcharts to perform these charting illustrations in an Angular fashion.
- By design, HighCharts API removed X-Axis click events for security reasons.
- A customEvents plugin does exist to add custom events such as this.
The problem:
In short, I'd like to add a click event to a label element and attach it to a method defined inside of an Angular component. However, I can't do this through normal means such as leveraging jQuery or native JavaScript to add an event listener on an element because of that very issue - the method I want is in Angular's world.
In an ideal world I'd like to do this (however, the wrapper does not provide this current opportunity):
<xAxis (click)="onClick($event)"></xAxis>
And I've been playing around with implementations such as (not working as onClick
is defined as a method inside of an Angular component):
$('#label-0').on('click', this.onClick(e));
I will continue to update this question with more details - please stay tuned.