I want to filter the view of my Google Scatter Chart when the webiste is loaded. There are different checkboxes, which get checked when the website is loaded and a function should check the status of the checkboxes and filter the rows of the chart data accordingly. This is the function, I use when the webiste is loaded:
// Filter for the initial draw of the ScatterChart
$(window).on('load', function() {
document.getElementById("checkbox_18650").checked = true;
document.getElementById("checkbox_21700").checked = true;
checkCells();
});
In Firefox everything is working fine, but in Chrome I get an uncaught reference error, that the "checkCells" is not defined. The checkCells function look like the following and is declared above the onload function:
checkCells = function() {
var values = [];
if (document.getElementById("checkbox_pouch").checked == true) {
values.push('pouch');
}
if (document.getElementById("checkbox_18650").checked == true) {
values.push('18650');
}
if (document.getElementById("checkbox_21700").checked == true) {
values.push('21700');
}
if (document.getElementById("checkbox_prismatic").checked == true) {
values.push('prismatic');
}
if (document.getElementById("checkbox_pouch").checked == false && document.getElementById("checkbox_18650").checked == false && document.getElementById("checkbox_21700").checked == false && document.getElementById("checkbox_prismatic").checked == false) {
values.push('empty');
}
if (values.length > 0) {
var myRows = view.setRows(data.getFilteredRows([{
column:2,
test: function (value) {
return (values.indexOf(value) > -1);
}
}]));
}
capacityRangeSlider.draw(myRows);
energyRangeSlider.draw(myRows);
powerRangeSlider.draw(myRows);
currentRangeSlider.draw(myRows);
dashboard.draw(view, drawOptions);
};
Anybody got an idea on how to fix this issue?