You can use the group function on your DataTable:
var groupedData = google.visualization.data.group(data, [{
type: 'number',
column: 0,
modifier: function () {return 0;}
}], [{
type: 'number',
column: 1,
aggregation: google.visualization.data.sum
}]);
var total = groupedData.getValue(0, 1);
That is no faster or easier to code than looping over your data and summing
it manually, though.
On Tuesday, April 22, 2014 5:38:34 AM UTC-4, Ravindra Gharge wrote:
>
> I have
> object for drawing the chart as
>
> [["town","sales"],["Mauje
> Sukene",1],["Mumbai",1361],["Nashik",1],["Thane",1],["Vile Parle",21]]
>
> and I want to display addition of the sales as the title on the chart
>
>
> On Tuesday, April 22, 2014 3:01:51 PM UTC+5:30, Ravindra Gharge wrote:
>>
>> I want to total all the values of the bars present in the column chart
>> and display as the title.
>> Is their any built in function available otherwise i have to loop trough
>> each record of the data object and have to take summation of that.
>>
>> 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/d/optout.