I am currently using Angular 7+ with Highcharts API.
I integrated Highcharts using the following Official Github Link.
There is a callbackFunction in Highcharts which we can use to get the chart instance .
However, i am yet to figure out 2 things:
- When does the actual instance of chart gets created along with the
options, like in which lifecycle hook in Angular? Or is it independent of the lifecycle hooks. I saw a developer's example in which he used the
callbackFunctionwhile inside thengOnInitlifecycle hook and it worked ( i.e we got a chart instance from the callback ). However the same did not work forngOnChangeshook.So my point was that, suppose there is an
@Inputproperty related tograph datawhich is to be rendered by the Highcharts.chart ( like say appending a new series ), then i would have to use ngOnChanges method in order to detect changes in input property and ngOnChanges would be called before ngOnInit as per this . How would i get the chart instance then ? and how would i do an addSeries then ?Why does
addSerieswork only onbutton clickand not in ngOnInit ? Uncomment line number 59 insidehello.component.tsto see it.
Please see hello.component.ts for any details.