highcharts / highcharts-angular

Highcharts official integration for Angular
Other
427 stars 117 forks source link

Documentation: Prefer `(chartInstance)` on init #384

Open wjaspers opened 2 months ago

wjaspers commented 2 months ago

When using the [chartCallback] to store a reference to the newly created chart, it is called again during export. This can be confusing if your chart is updated dynamically, as the original chart reference will be reassigned.

karolkolodziej commented 1 month ago

Hi @wjaspers! Thank you for the feedback. The chart callback is triggered on export regardless using highcharts-anuglar- see demo.

This isn't properly documented but the best way to get the chart instance reference is by the Output: https://github.com/highcharts/highcharts-angular/blob/b4751e5f915692f13a61f8b0fa8c4b428cdc9f30/highcharts-angular/src/lib/highcharts-chart.component.ts#L20

Let's treat this as a documentation improvement task.