react-highcharts icon indicating copy to clipboard operation
react-highcharts copied to clipboard

Highcharts should be updated not re-made every update.

Open ram4nd opened this issue 7 years ago • 4 comments

When you change the configuration. Render creates new charts from scratch. This should be rewritten so charts would be updated not created from scratch.

ram4nd avatar Mar 28 '17 10:03 ram4nd

There's a isPureConfig and a neverFlow property you can use. Perhaps those can help?

arift avatar May 03 '17 13:05 arift

@arift

Except those do absolutely nothing to prevent new Highchart(...) from begin called.

If neverReflow is true, then shouldComponentUpdate is true, forcing react to unmount and re-render the whole component.

If neverReflow is false, renderChart is called leading to new Highchart({...})

Any way you look at it - there is no 'update this existing chart with this new configuration/data' and then this.chart.redraw().

johnbouma avatar Sep 13 '17 21:09 johnbouma

How about keeping a reference to the chart api and then use chartApi.update(options) where options is the chart config object you're trying to update your chart to? That should work since you're not mutating the original config object, which is causing a redraw.

arift avatar Sep 14 '17 21:09 arift

one general question maybe related. What's the best way let's say to remove a xAxis.plotBand for a complicated plot? Should I change the config file and let it rerender the whole thing, or just use a reference (to the charts) to use removePlotBand(id) member function?

thank you.

bfang711 avatar Feb 02 '18 16:02 bfang711