Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to use highcharts-angular callback function to get chart object

I have used https://github.com/highcharts/highcharts-angular this official wrapper and try to call the callback function to get the chart object. Unfortunately, though I tried various methods that did not give any proper results as I expect. Also, there aren't many documents that describe the callback function. Can someone let me know how to use the callback function?

like image 421
Chandana Avatar asked Dec 18 '25 07:12

Chandana


1 Answers

The callback didn't work for me either. I was inspecting the code source and I saw the @Output event emitter called chartInstance... It is also documented:

component output chartInstance - emitted after chart is created (see demo app and logChartInstance function)

So I've used as a normal output event binding:

<highcharts-chart
 [Highcharts]="Highcharts"
 [options]="chartOptions"
 ...
 (chartInstance)="onChartInstance($event)"
 ...
></highcharts-chart>

And voilà... I think that is not a definitive solution but as a temporary workaround it works pretty well for me.

like image 53
Max Becerra Avatar answered Dec 21 '25 02:12

Max Becerra