Hi asgallant,
Thanks for the response.
I believe I understand what you are suggesting for the function
drawCharts(isStacked)....
The option "isStacked" would have a "variable" called "isStacked"
drawCharts(isStacked) would then be called in the following manner
drawCharts(true)... Yes/No?
However the more problematic thing for me is how and where a listener
is determined in the code to "listen" for the "onClick" event, if and
when the "stackButton" is clicked. Based on available code samples on
the code playground I see the following...
// Create the dashboard
var dashboard = new google.visualization.Dashboard(
document.getElementById('dashboard'));
// Register a listener to be notified once the dashboard is ready.
google.visualization.events.addListener(dashboard, 'ready',
dashboardReady);
// Configure the dashboard so that the slider to affect the
piechart,
// then draw the dashboard.
dashboard.bind(slider, piechart).draw(data);
}
function dashboardReady() {
// The dashboard is ready to accept interaction. Configure the
buttons to
// programmatically affect the dashboard when clicked.
// Change the slider selected range when clicked.
document.getElementById('rangeButton').onclick = function() {
slider.setState({'lowValue': 2, 'highValue': 5});
slider.draw();
};
// Change the pie chart rendering options when clicked.
document.getElementById('optionsButton').onclick = function() {
piechart.setOption('is3D', true);
piechart.draw();
};
}
google.setOnLoadCallback(drawVisualization);
However this differs from my declaration of the Dashboard (developed
from other code samples) in that I do not create a variable to to hold
the "Dashboard"
// Create a dashboard
new
google.visualization.Dashboard(document.getElementById('dashboard')).
// Establish bindings, declaring Year and Category control all charts.
bind([yearControl, categoryControl], [mainSite, emeaSite, tierSite,
compareSite]).
// bindings to control site pick... each chart can display data from
different sites.
bind([mainSiteControl], [mainSite]).
bind([emeaSiteControl], [emeaSite]).
bind([tierSiteControl], [tierSite]).
bind([compareSiteControl], [compareSite]).
// Draw the entire dashboard.
draw(data);
}
// setting the value and calling the drawing function
function setValue(thisValue) {
x = eval(thisValue); // assigning the real array (as passed by the
dropdown)
drawCharts(); // calling the drawing function
}
google.setOnLoadCallback(drawVisualization);
My understanding is that I need an event listener, but how do I
implement within my code.