我想建立一个能够进行交互式刷新的图表。我使用jqPlot,但是试图通过调用replot()或redraw()来更新图表会导致浏览器内存泄漏。您有任何想法如何解决这个问题吗?
function crateChart() {
var s1 = [['a',6], ['b',8], ['c',14], ['d',20]];
var s2 = [['a', 8], ['b', 12], ['c', 6], ['d', 9]];
this.plot = $.jqplot('chart', [s1, s2], {
seriesDefaults: {
renderer:$.jqplot.DonutRenderer,
rendererOptions:{
sliceMargin: 3,
startAngle: -90,
showDataLabels: true,
dataLabels: 'value'
}
}
});
}
function update () {
ChartTester.plot.series[0].data = [
['a', Math.random() * 100],
['b', Math.random() * 100],
['c', Math.random() * 100],
['d', Math.random() * 100]
];
ChartTester.plot.destroy();
$('#chart *').unbind();
$('#chart').empty();
ChartTester.plot.redraw();
}