Hi everyone,

I am fairly new to coding and have created a webpage with multiple 
dashboards on it. However over time the memory keeps increasing, I have 
pinned it down to when I draw each dashboard. I am doing this every 5 
seconds.

Here is my code for one of the dashboards: 

var chart, dashboard, rangeSlider, prevChart, prevDash, prevSlide;
function allChart() {
var data = new google.visualization.DataTable();
data.addColumn('datetime', 'Time');
for (var i = 0; i<siloArray.length; i++) {
data.addColumn('number', siloArray[i]);
}

data.addRows(allChartData);

var sliderOptions = {
controlType: 'ChartRangeFilter',
containerId: 'sChartFilter',
options: {
filterColumnLabel: 'Time',
ui: {
chartOptions: {
height:50,
width: '100%',
colors: colors,
chartArea: {
width: '90%'
},
hAxis: {

}
},
snapToData: true
}
},
}

var allOptions = {
chartType: 'LineChart',
containerId: 'sChart',
options: {
width: '100%',
height: 560,
focusTarget: 'category',
colors: colors,
legend: {
position: 'top',
maxLines: 5,
},
title: 'Number of Sessions based on Time',
chartArea: {
top: 100,
bottom: 60,
width: '90%',
height: '65%'
},
hAxis: {
title: 'Time',
},
vAxis: {
title: 'Number of Sessions',
format: '0',
maxValue: 6,
minValue: 0
},
},
view:{
}
}

var colArray = [];
for (var j = 0; j<siloArray.length; j++) {
colArray.push(j);
}
allOptions.view.columns = colArray;

if (allChartData.length == 1) {
allOptions.options.hAxis.ticks = [allChartData[0][0]];
sliderOptions.options.ui.chartOptions.hAxis.ticks = [allChartData[0][0]];
}

prevChart = chart;
prevDash = dashboard;
prevSlide = rangeSlider;

rangeSlider = new google.visualization.ControlWrapper(sliderOptions);
chart = new google.visualization.ChartWrapper(allOptions);
dashboard = new google.visualization.Dashboard(document.getElementById(
"sDashboard")).
bind([rangeSlider], [chart]).

draw(data);

if (prevDash) {
prevDash.visualization.dispose();
prevChart.visualization.clearChart();
prevSlide.visualization.dispose();
}
}

Any help is appreciated.
Lucas

-- 
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/google-visualization-api.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-visualization-api/420d974d-1eb9-4b68-ab70-366657e229f1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to