You can use the group function to sum columns in your DataTable, and then 
insert that total into your heading:

// group the data table to get the sum of column 1
var group = google.visualization.data.group(data, [{
    column: 0,
    type: 'number',
    // modify column 0 to return the same for all rows
    // so we can get the sum of everything in column 1
    modifier: function () {
        return 0;
    }
}], [{
    // get the sum of column 1
    column: 1,
    type: 'number',
    aggregation: google.visualization.data.sum
}]);

var sum = group.getValue(0, 1);
// put the sum wherever you need it

On Tuesday, September 11, 2012 7:19:26 AM UTC-4, Wesley Chin wrote:
>
> Hi everyone,
>
> I have 2 working charts (a vertical bar and a pie chart) that are 
> displaying totals for me.  I want to add up all the totals that are 
> displayed on each chart and put it into the heading, is that possible?  I 
> have a div with the heading (I am using html, PHP and javascript) and would 
> like to put the total in it.  How can I achieve that?
>
> Regards,
> Wesley
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-visualization-api/-/RwjXWUUKn-0J.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-visualization-api?hl=en.

Reply via email to