Closed soaMan closed 8 years ago
redraw a flotr2 charts when data polled from server
the polling worked every 30s , and updated chart
then occured memory increas too high
function drawchart(chartId, min, max, text) { $('canvas').remove(); var d1 = []; var options, container, o; container = document.getElementById(chartId); d1 = [{data : cpuArray, label:'Usage Rate', lines :{fill:true}}]; if (!firstDraw) { options = { xaxis : { mode : 'time', timeMode : 'local', labelsAngle : 0 }, selection : { mode : 'x' }, legend : { show: false }, yaxis : { min : min, max : max }, grid : { verticalLines : false, horizontalLines : true, tickColor : '#6C6B6C' }, mouse : { track : true, trackFormatter: function(obj) { return obj.series.label + '\t' + ' : ' + obj.y+text; }, relative : true }, HtmlText : true, title : chartId }; // Draw graph with default options, overwriting with passed options function drawGraph(opts) { // Clone the options, so the 'options' variable always keeps intact. // o = Flotr..extend(Flotr..clone(options), opts || {}); return Flotr.draw(container, d1, options); } } drawGraph(); }
@soaMan please wrap your code with following syntax:
```javascript <your code>
redraw a flotr2 charts when data polled from server
the polling worked every 30s , and updated chart
then occured memory increas too high
i attached my source example below
function drawchart(chartId, min, max, text) { $('canvas').remove(); var d1 = []; var options, container, o; container = document.getElementById(chartId); d1 = [{data : cpuArray, label:'Usage Rate', lines :{fill:true}}]; if (!firstDraw) { options = { xaxis : { mode : 'time', timeMode : 'local', labelsAngle : 0 }, selection : { mode : 'x' }, legend : { show: false }, yaxis : { min : min, max : max }, grid : { verticalLines : false, horizontalLines : true, tickColor : '#6C6B6C' }, mouse : { track : true, trackFormatter: function(obj) { return obj.series.label + '\t' + ' : ' + obj.y+text; }, relative : true }, HtmlText : true, title : chartId }; // Draw graph with default options, overwriting with passed options function drawGraph(opts) { // Clone the options, so the 'options' variable always keeps intact. // o = Flotr..extend(Flotr..clone(options), opts || {}); return Flotr.draw(container, d1, options); } } drawGraph(); }