-
Notifications
You must be signed in to change notification settings - Fork 335
Description
Hello, I recently switched Chart.js from v2.x to 3.x. I also use the chartjs-plugin-zoom 1.0.1. My situation is this I have SPA with some tabs, on one tab are the charts, between them line chart and for this one I use the zoom plugin, because data are usually huge.
When I transit from page with charts to another, this is called for cleaning:
if (this._chart)
{
this._chart.options.onClick = null;
//desperate attempt to save situation
this._chart.options.plugins = null;
this._chart.clear();
this._chart.destroy();
}
I expected that destroy do everything necessary from memory perspective. For version 2 it is working, but here I observe strange behavior. When I switch from chart page to another and inspect memory I saw LineController(object asociated with chart.js) between objects. When I switch back to chart page and then again to another memory consumtion raise and count of LineController too. Raising instances
What i find out is this, when I comment the zoom plugin from options everything is working again, no more raising LineControll instances no visible memory consumption raise between pages switching. But this plugin is necessary for me, so commenting out is not good option. I tried manually set plugins for chart to null:
this._chart.options.plugins = null;
But this not solve the memory problem. Has anybody face such condition? I also posted question to with code snippets so