问题描述
- fusioncharts,反复创建,内存不断增加,最后卡死,怎么破?http://ask.csdn.net/questions/194957#
-
$(function(){ var revenueChart; fun(); setInterval(fun,1000); }); function fun(){ //revenueChart.removeChild(); $("#chartContainer").html(""); $("#chartobject-1").css("display","none"); $("#chartobject-1").remove(); $(".fusioncharts-smartlabel-container").html(""); $(".fusioncharts-smartlabel-container").remove(); revenueChart =null; delete revenueChart; //CollectGarbage(); FusionCharts.ready(function(){ revenueChart = new FusionCharts({ "type": "mscolumn2d", "renderAt": "chartContainer", "width": "1000", "height": "500", "dataFormat": "json", "dataSource": { "chart": { "bgAlpha": "100", "theme": "my", "placeValuesInside": "0", "outCnvBaseFontSize": "14", "rotateValues": "0" }, "categories": [ { "category": [ { "label": "Jan" }, { "label": "Feb" }, { "label": "Mar" }, { "label": "Sep" }, { "label": "Oct" } ] } ], "dataset": [ { "data": [ { "value": "22400" }, { "value": "24800" }, { "value": "21800" }, { "value": "23700" }, { "value": "25900" } ] }, { "data": [ { "value": "10000" }, { "value": "11500" }, { "value": "12500" }, { "value": "21700" }, { "value": "21900" } ] } ] } }); revenueChart.render(); }) }
解决方案
fusioncharts不是有setDataURL用于设置加载不同数据源,干嘛要不断的重新生产fusioncharts
var chartObj = getChartFromId("chart1Id");
chartObj.setDataURL("nd.xml");
时间: 2024-10-03 11:13:45