score:6

Accepted answer

changing only options will not work for highcharts - those options are used once for generating chart. if you want to change those options you should call chart.update with new options or a more dedicated update e.g. for series data you can use series.setdata.

how others are handling this:

  1. official highcharts react wrapper highcharts-react is using chart.update - the relevant code line.

  2. third party react-highcharts is rebuilding highcharts chart using new options. it's less optimal, but generally a more secure approach for them (it's third party code, so in case of any bugs they need to wait for the bug to be resolved). relevant code: call renderchart on updates and creating the chart in the renderchart.

  3. third party react-highcharts-wrapper also rebuilds a chart on update - here is explained why.

about animation:

when chart is rebuild (created anew) initial animation runs (unless otherwise specified in chart's animation option) and for dynamic updates like chart.update chart is redrawn with animation enabled by default.


Related Query

More Query from same tag