Search code examples
angulares6-modulesamcharts4

how to dispose an amchart line chart on each iteration of a data loop?


I am using a for loop to iterate a data coming from a remote API. i added

ngOnDestroy() {
   this.chart.dispose();
}

but it seems like it's not being called at all which end up my application crashing after about 25+ times of reloading a live chart using a remote backend API. what's the best solution for this to prevent my application from crashing ?


Solution

  • I solved the problem by closing all the DB Queries from the remote backend API, then it stopped the crashing of the application.