开发者

What to do with jqPlot memory leak?

开发者 https://www.devze.com 2023-03-13 09:16 出处:网络
I have heard from too many people that JavaScript libruaries like jqPlot or Flot that are designed to draw g开发者_JS百科raphs have memory leaks if updated live for a long period of time. I know that

I have heard from too many people that JavaScript libruaries like jqPlot or Flot that are designed to draw g开发者_JS百科raphs have memory leaks if updated live for a long period of time. I know that most use the replot() function to update the graph in real time but that's where the problem seems to happen.

Has anybody figured out a work around this? Maybe refreshing the entire graph and the jquery code in a DIV?


you should use the “destroy” method (plot.destroy()) on your plot before you empty the container and draw the plot again. It worked for me!


No, i tried it with emptying the div and redraw the complete diagram with jqPlot. That doesn't help either. I did it like this:

$('#diagramContainer').empty();
targetPlot = $.jqplot('#diagramContainer',
    toDraw, diagramOptions);

Doing this lots of times with many data leads also to memory leaks.

0

精彩评论

暂无评论...
验证码 换一张
取 消