If you want a "Totals" *row,* you'll have to do the calculation yourself,
and add the data as an additional row in your DataTable object. If you want
a "Totals" *column*, you can use a DataView with a calculated column:
/* assumes:
* view is a DataView object
* chart is the Chart object of the chart you are going to draw
* options is an option object for drawing the charts
* dataTable and rowNum are NOT used elsewhere
* sums columns 1 and 2 of the DataTable object into column 3 of the view
*/
view.setColumns([0, 1, 2, {
type: 'number',
label: 'Total',
func: function (dataTable, rowNum) {
return dataTable.getValue(rowNum, 1) + dataTable.getValue(rowNum, 2)
;
}
}]);
chart.draw(view, options);
--
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/-/zevSD3HjaEcJ.
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.