react-highcharts
react-highcharts copied to clipboard
Highcharts should be updated not re-made every update.
When you change the configuration. Render creates new charts from scratch. This should be rewritten so charts would be updated not created from scratch.
There's a isPureConfig and a neverFlow property you can use. Perhaps those can help?
@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()
.
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.
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.