开发者

Charting library that does not cause memory leak when updating chart

开发者 https://www.devze.com 2023-02-16 08:36 出处:网络
I want to build a page with interactively refreshing charts based on the data that is being fetched from the server asynchronously using AJAX. I really like jqPlot, but when trying to update the graph

I want to build a page with interactively refreshing charts based on the data that is being fetched from the server asynchronously using AJAX. I really like jqPlot, but when trying to update the graph periodically (by calling replot(), without page refresh), it causes a huge browser memory leak. It seems to be a well known issue occurring on all major browsers.

开发者_运维问答

I haven't tried Flot and protovis, but quick googling reveals that they seem to have the same problems.

Are you aware of any JavaScript charting library that does not introduce memory leak after several updates of the chart?


You could take a look at Highcharts. A quick googling doesn't seem to indicate that memory leaks are much of an issue.


to avoid jqPlot memory leak you have to remove binding and destry your chart:

var chart;

function yourTimedFunction(data) {
    if (chart) 
    {
        $('#chartDiv *').unbind(); // iexplorer
        chart.destroy();
    }
    chart = $.jqplot('chartDiv', ............. ); 
}
0

精彩评论

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

关注公众号