I would recommend sorting your DataTable the way you need it for one of the 
charts.  Remove the other chart from the Dashboard (just take it out of the 
Dashboard#bind call), and set up a "ready" event handler on the first chart 
that creates a new DataView based on the data from the first chart, sorts 
the view, and uses it as the data source of the second chart:

// assumes "Chart1" is in the Dashboard and "Chart2" is not
google.visualization.events.addListener(Chart1, 'ready', function () {
    var dt = Chart1.getDataTable();
    var view =  new google.visualization.DataView(dt);
    view.setRows(dt.getSortedRows(/* sorting criteria */));
    Chart2.setDataTable(view);
    Chart2.draw();
});

This will draw Chart2 every time Chart1 draws, using the same data sorted 
in a different order.

On Friday, May 23, 2014 4:28:53 PM UTC-4, AM wrote:
>
> I have a data table and make 10 charts off that data table.
>
> Its all part of dashboard binded to a categoryPicker control.
>
> Is there a way to have each chart sorted differently?  It seems like I 
> would have to create a different data view for each chart maybe?  If I do 
> that though, do I also have to have a different dashboard for each?
>
> Here is the sample code I use for two charts:
>
> var Chart1 = new google.visualization.ChartWrapper({
> 'chartType':'BarChart',
> 'containerId':'chart_div1',
> 'options': {
> 'width':350.0,
> 'height':300.0,
> 'legend':'none',
> 'hAxis':{'minValue':0,'format':'$#,###'},
> 'chartArea':{left:150,top:10,width:"65%",height:"80%"}},
> 'view':{'columns':[0,3,38]}});
>
> var Chart2 = new google.visualization.ChartWrapper({
> 'chartType':'BarChart',
> 'containerId':'chart_div2',
> 'options': {
> 'width':350.0,
> 'height':300.0,
> 'legend':'none',
> 'hAxis':{format:'$#,###'},
> 'chartArea':{left:150,top:10,width:"65%",height:"80%"}},
> 'view':{'columns':[0,4,38]}});
>
> Thanks for any help.
>
>

-- 
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 [email protected].
To post to this group, send email to [email protected].
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