You need to use the google.visualization.data.group function:

var groupedData = google.visualization.data.group(data, [0], [{
    column: 3,
    type: 'number',
    label: dataTable.getColumnLabel(3),
    aggregation: google.visualization.data.sum
}]);

var table3 = new google.visualization.Table(document.getElementById('table3'));
table3.draw(groupedData, null);

On Thursday, December 12, 2013 2:07:20 PM UTC-5, Ravindra Gharge wrote:
>
> This is my data table : 
>
>        var dataTable = google.visualization.arrayToDataTable([
>           ['Country', 'Region/State', 'City', 'Population'],
>           ['USA', 'California', 'San Francisco', 1000],
>           ['USA', 'California', 'Los Angeles', 1000],
>           ['USA', 'California', 'Mountain View', 1000],
>           ['USA', 'New York', 'New York', 1000],
>           ['USA', 'New York', 'Albany', 1000],
>           ['France', 'Ile-de-France', 'Paris', 2000],
>           ['France', 'Ile-de-France', 'Orly', 2000],
>           ['France', 'Provence', 'Marseille', 2000],
>           ['France', 'Provence', 'Nice', 2000]
>         ]);
>       
>
>       following statements  will set the dataView2 to the country and 
> population 
> columns 
>       
>
>          // Set rows in a data view.
>         var dataView2 = new google.visualization.DataView(dataTable);
>         dataView2.setColumns([0 3]);
>       
>         var table3 = new google.visualization.Table(document.
> getElementById('table3'));
>         table3.draw(dataView2, null);
>      
>
>
>       I want the result as the sum of the population of the USA and France 
> Table must be 
>
> Country    population
>
> USA         5000           //sum of all 
> France      8000           // sum of all
>
> I want the way in which i will query the data source table to form a 
> dataview
>
> Please help
>
>  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 [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/groups/opt_out.

Reply via email to