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

Implementation of highcharts.destroy() and highcharts.update() functions #56

Closed
fervanrijswijk opened this issue Aug 28, 2017 · 2 comments

Comments

@fervanrijswijk
Copy link

fervanrijswijk commented Aug 28, 2017

Highcharts has functions to update and destroy a chart. When data changes every few seconds, the chart can be updated instead of created over and over again without the ability of being destroyed.

I would like to be able to do one of the things below to prevent memory leaks.

private createHighchart (options: HighchartOptions): void {
    if(this.chart) {
      this.chart.update(options);
    }
    else {
      this.chart = new Highchart(options);
    }
  }
private createHighchart (options: HighchartOptions): void {
    if(this.chart) {
      this.chart.destroy();
    }
    else {
      this.chart = new Highchart(options);
    }
  }
@cebor
Copy link
Owner

cebor commented Aug 28, 2017

@fervanrijswijk its possible: try to use this.chart.ref. This is a reference to the original highcharts object.

see: https://github.com/cebor/angular-highcharts#properties

@fervanrijswijk
Copy link
Author

Thanks!

@cebor cebor closed this as completed Aug 29, 2017
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

No branches or pull requests

2 participants