1

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

1 Answer 1

1

I used the global variable and it worked; There was some coding error the previous time I used it - which I overlooked

It will still be interesting to see if anyone can help me with how I can return a value from the callback function

Sign up to request clarification or add additional context in comments.

2 Comments

Just wondering if you ever found an answer to this question. I'm trying to get the results of query.send back into a Google Sheets cell, and can't see how to return the value.
@DavidGoldfarb - sorry I did not have any response

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.