You cannot use a chart's "ready" event handler to draw the chart - it will 
loop infinitely (draw -> ready -> draw -> ready, ad infinitum).  Use a 
"ready" event handler for another chart hooked up to the same filters 
instead, and remove Chart1 from your Dashboard binding:

// assumes Chart2 is bound to the same filters you want Chart1 to use
google.visualization.events.addListener(Chart2, 'ready', function () {
    var dt = Chart2.getDataTable();
   
    var filterView1 = new google.visualization.DataView(dt);
    filterView1.setRows(dt.getFilteredRows([{'column': 3, 'value': 
'City/Town/Place*'}]));
    var view1 = new google.visualization.DataView(filterView1);
    view1.setRows(filterView1.getSortedRows(36));
    Chart1.setDataTable(view1);
    Chart1.draw();
}

If you don't have another chart that uses the same filters, you can insert 
an intermediate chart to serve the purpose; just hide this chart's 
container div and the user will not know the difference.  I typically use a 
Table visualization for this, with the rows limited to 1 to keep the impact 
of the Table on the page performance down:

var dummyTable = new google.visualization.ChartWrapper({
    chartType: 'Table',
    containerId: 'dummy_table_div',
    view: {
        rows: [0]
    }
});

On Friday, August 15, 2014 12:48:14 PM UTC-4, AM wrote:
>
> Trying to filter out a couple of data points for the first chart in a 
> dashboard of many charts.
>
> Filtering data works fine for all the other charts except the first one. I 
> think because its the first one I have to do something different.  Here is 
> the relevant code for what I'm doing now:
>
>
> var dashboard = new 
> google.visualization.Dashboard(document.getElementById('chart_div1')).bind([categoryPicker1],[Chart1,Chart4]).draw(data1);
>
> google.visualization.events.addListener(Chart1, 'ready', function () {
>     var dt = Chart1.getDataTable();
>    
>     var filterView1 = new google.visualization.DataView(dt);
>     filterView1.setRows(dt.getFilteredRows([{'column': 3, 'value': 
> 'City/Town/Place*'}]));
>     var view1 = new google.visualization.DataView(filterView1);
>     view1.setRows(filterView1.getSortedRows(36));
>     Chart1.setDataTable(view1);
>     Chart1.draw();
>
>
> This causes an error, "too much recursion":
>
> too much recursion×
> too much recursion×
> too much recursion×
> too much recursion×
> - See more at: 
> http://towncharts.com/testing/Abanda-CDP-AL-Demographics-data.html#sthash.TMEdcoyp.dpuf
>
>
> The actual page where this is done is:  
> http://towncharts.com/testing/Abanda-CDP-AL-Demographics-data.html
>
>
> Any pointers would be greatly appreciated.
>
> Thanks!
>

-- 
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 google-visualization-api+unsubscr...@googlegroups.com.
To post to this group, send email to google-visualization-api@googlegroups.com.
Visit this group at http://groups.google.com/group/google-visualization-api.
For more options, visit https://groups.google.com/d/optout.

Reply via email to