简体   繁体   中英

resizeSensor Amcharts on Angular

Im using Amcharts for a while and im happy with it, but i discovered a bug on my app.

If I leave the graphics screen to another component, it creates a space of 7 hidden divs. Those divs are from Amcharts.

The official documentation says that this happens because charts are using a resize sensor which gets knocked of its feet when chart container is moved about in a DOM tree.

The solution is to implement: chart.svgContainer.resizeSensor.reset();

BUT resizeSensor.reset() is getting deprecated on my code and i dont know why!

https://imgur.com/gallery/17ry8kg

this is the official documentation about this problem:

https://www.amcharts.com/docs/v4/getting-started/integrations/using-angular2/#Fixing_broken_resizing_on_route

Got the solution, i just need to unsubscribe with "am4core.disposeAllCharts();" on ngOnDestroy.

That did the trick

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM