0
votes

I understand that Google Charts API need a numeric input value for the charts to render. In their examples I have seen how a particular column will contain this numeric value. For example:

[
    ['Mushrooms', 3],
    ['Onions', 1],
    ['Olives', 1],
    ['Zucchini', 1],
    ['Pepperoni', 2]
]

However, my chart requires me to filter through a dataset to obtain the count (similar to that of SQL) that fits the bill. For example:

[
    ['Mary', '10/10/1991'],
    ['Peter', '07/12/1991'],
    ['Jacob', '06/05/1992'],
]

I hope then that I can get the Chart API to filter my dataset by year, and render a chart that shows 1991 with 2/3 of the pie, and 1992 with 1/3 of the pie.

Is this possible using Google Charts API, or am I required to write specific SQL queries and form my own JSONs to render this sort of chart? Many thanks...

1
Something to get you started: jsfiddle.net/cchana/PbKs9 - I have taken your current values and converted the values into years and forced the type to be a number. Not sure how to increment, but hopefully a starting point. - cchana

1 Answers

0
votes

Google Chart API does have its own data manipulation methods; take a look at: http://developers.google.com/chart/interactive/docs/reference#google_visualization_data

There are two functions, namely group() and join(). In this case, group() would be the most useful for data manipulation.