I am not grappling with a specific problem per se, but I think my question is also more than a mere opinion. When it comes to both best practices and efficiency for Highcharts, is it better to update a chart object, or destroy the chart and create a new one?
I am working on a project with dozens of charts. Some charts required an update of axes, or data format changes to the point where it was determined that building a whole new chart object was the best option. We've started doing this as a standard, even when the charts are to the point and not very complicated. It's got me wondering if the resource expenditure is negligible, or if we're doing ourselves a real disserve.
Here's how our average chart creation works:
- The page has a variety of menu options
- When an end user changes a menu option, an API call is made to retrieve new data
- If new data retrieval is successful, the target chart object is destroyed and a new one created using the data (plus any other chart options we need specific to the menu options, like title, year range, etc...)
If we were updating, then steps 1 and 2 would be the same, but for step 3 instead of destroying the chart object, we just update the series data and chart options.
Is there strong evidence for one method over the other?