Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added ability to delay destroying of highcharts for animations. #10

Closed
wants to merge 5 commits into from

Conversation

ErwanLent
Copy link

I've added the ability to delay destroying of highcharts to let animations finish without a memory leak.

@ErwanLent
Copy link
Author

ErwanLent commented Jan 24, 2017

I've found a solution. chart.destroy() needs to be called for there to be no memory leak. However, if you wait a delay inside the beforeDestroy event, this.chart becomes null and you cannot call destroy() on it. Highcharts, however, saves all the charts globally in Highcharts.charts. If you store the chart id in beforeDestroy, wait a delay for a transition to finish, then call the destroy() function on the chart stored in the Highcharts.charts array, the problem is solved.

I've forked the repo and added a destroyDelay prop that gives the option of putting in a millisecond amount before the highcharts is destroyed. I've run the build process, forked the repo, and opened a pull request. Please feel free to change the prop name.

Fix can be played with here: https://jsfiddle.net/hpkoemtw/2/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants