Author: croberts Date: 2011-11-14 14:45:16 +0000 (Mon, 14 Nov 2011) New Revision: 5141
Modified: branches/noflash/cumin/resources/app.js Log: More jqplot memory leak fixes. Also, fixing the console exceptions when mousing over pie charts that are drawn *after* a line chart had been drawn. This was because $j.jqplot.config.enablePlugins gets set to true for line charts. The fix is to set $j.jqplot.config.enablePlugins = false when drawing a pie chart (that hopefully doesn't require any plugins).
Modified: branches/noflash/cumin/resources/app.js =================================================================== --- branches/noflash/cumin/resources/app.js 2011-11-11 22:23:08 UTC (rev 5140) +++ branches/noflash/cumin/resources/app.js 2011-11-14 14:45:16 UTC (rev 5141) @@ -603,7 +603,17 @@ if(allCharts[divName]) { var parent = $(divName).getParent(); var newDiv = $(divName); - allCharts[divName].destroy(); + allCharts[divName].canvasManager.freeAllCanvases(); + if (allCharts[divName].eventCanvas) { + allCharts[divName].eventCanvas._elem.unbind(); + } + // Couple of posts on Stack Overflow indicate that empty() doesn't + // always cear up the dom and release memory. Sometimes setting + // innerHTML property to null is needed. Particularly on IE, may + // have to directly set it to null, bypassing jQuery. + allCharts[divName].target.empty(); + allCharts[divName].target[0].innerHTML = ''; + allCharts[divName].destroy(); newDiv.inject(parent); allCharts[divName] = $j.jqplot(holder, dataContainer['y_coordinate_values'],chartOptionsObject); } else { @@ -647,6 +657,7 @@ }
updatePieChart = function (piediv, vals, colors) { + $j.jqplot.config.enablePlugins = false; var data = vals; if(allCharts[piediv]) { allCharts[piediv].destroy(); @@ -675,8 +686,9 @@ highlightMouseOver: false } }, - legend: { show:false}, - seriesColors: colors + legend: {show:false}, + seriesColors: colors, + cursor: {show:false}, } ); }
cumin-developers@lists.fedorahosted.org