I am trying to have two google dashboards which have the same control filter I define both the control filters one of them hidden; The value for the hidden control filter will be set on change of the main control filter
This example requires the objects of control filters available to manipulate
This is possible with normal data
however my situation is a little complicate as I am using google sheets
function buildGDPChart( ) {
var queryString = encodeURIComponent('SELECT C, D, sum(U) where A=2013 group by c, D');
var query = new google.visualization.Query(
'https://docs.google.com/spreadsheets/d/1Q1QjRKtin6KD1Q18909134sWD61mEekbFxUmJdEE0/gviz/tq?gid=0&headers=1&sheet=Sheet1&headers=1&tq=' + queryString);
query.send( drawDashboard);
}
function drawDashboard( response ) {
var gdpData = response.getDataTable( );
var gdpDashboard = new google.visualization.Dashboard( document.getElementById('GDP_Dashboard_div'));
var industryPicker = new google.visualization.ControlWrapper({
'controlType': 'CategoryFilter',
'containerId': 'industryPicker_div',
'options': {
'filterColumnIndex': 1,
'ui': {
'labelStacking': 'vertical',
'label': 'Industry:',
'allowTyping': false,
'allowMultiple': false
}
},
'state': { 'selectedValues' : [ 'Agriculture'] }
});
industryPickerControl = document.getElementById( 'industryPickerControl_div');
industryPickerControl.objectValue = industryPicker;
google.visualization.events.addListener(industryPicker, 'statechange', function() {
var industryPickerH = document.getElementById( 'industryPickerHControl_Div');
industryPickerH.objectValue.setState(industryPicker.getState());
industryPickerH.draw();
});
var subIndustryTable = new google.visualization.ChartWrapper({
'chartType': 'Table',
'containerId': 'subIndustry_Table_div',
'options': {
},
'view' : { 'columns': [0,2] }
});
var subIndustryPieChart = new google.visualization.ChartWrapper({
'chartType': 'PieChart',
'containerId': 'subIndustry_PieChart_div',
'options': {
'width': 150,
'height': 150,
'legend': 'none',
'chartArea': {'left': 15, 'top': 15, 'right': 0, 'bottom': 0},
'pieSliceText': 'label'
},
'view': {'columns': [0, 2]}
});
gdpDashboard.bind([industryPicker], [subIndustryPieChart, subIndustryTable]);
gdpDashboard.draw( gdpData );
}
I need to store the value of industryPicker outside of the function for further processing;
I defined industryPicker as a global variable; however it is still processed as a local variable and the value is not available outside of the function.
Is there a way to return this object or access this object