Re: [visualization-api] Filtering data by date

183 views
Skip to first unread message

Sergey Grabkovsky

unread,
Dec 19, 2012, 3:11:38 PM12/19/12
to google-visua...@googlegroups.com
Hi, unfortunately the NumberRangeFilter control currently doesn't support dates, so the next closest thing is the ChartRangeFilter control, but you still can't aggregate things automatically for a column (even for Pie charts). So I'm afraid that your only option is to use the ChartRangeFilter control and handle its events in such a way that it generates a new DataTable or DataView and redraws the chart.

- Sergey



On Wed, Dec 19, 2012 at 2:15 PM, <yoram....@eyeclick.com> wrote:
Hi all

I'm a newbie and need help with creating a chart that I can filter the data dynamiclly.
Assuming I have the following data table
Date                Type       Amount
01/01/2012       blue          5
01/01/2012       green        6
01/01/2012       yellow       4
01/02/2012       blue          1
01/02/2012       green        3
01/02/2012       red           2
01/03/2012       blue          2
01/03/2012       red           5
01/03/2012       yellow       4

I want to create a chart (lets say ColumnChart) that displays sun(Amount) group by Type and I want to filter it by the date with a dynamic controller.
for example:
If I select in the filter from 01/01/2012 to 01/01/2012 => I'll see 3 columns, blue(5), green(6), yellow(4)
If I select in the filter from 01/01/2012 to 01/02/2012 => I'll see 4 columns, blue(6), green(9), yellow(4), red(2)

How can I do that??
Many thanks,
Yoram


--
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/-/WgVCIDgg8FkJ.
To post to this group, send email to google-visua...@googlegroups.com.
To unsubscribe from this group, send email to google-visualizati...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-visualization-api?hl=en.

asgallant

unread,
Dec 19, 2012, 3:46:54 PM12/19/12
to google-visua...@googlegroups.com
I have an example of this (using a GeoChart, but it works with pretty much any chart type) here: http://jsfiddle.net/asgallant/Fs3Hb/

- Sergey



To unsubscribe from this group, send email to google-visualization-api+unsub...@googlegroups.com.

Yoram

unread,
Dec 20, 2012, 2:40:19 AM12/20/12
to google-visua...@googlegroups.com
Hi Sergey and asgallant

Thanks for your replies. That was very much helpful!!

asgallant: 
I saw your example (great job), is there a way to reduce the flickering.
I guess it flickers because of the repeated ChartRangeFilter statechange events.

Thanks for the help,
Yoram

Yoram

unread,
Dec 20, 2012, 7:56:48 AM12/20/12
to google-visua...@googlegroups.com
Just wanted to update that I manage to create the filter with your help.
I'm using a ColumnChart and I'm not experiencing any flickering.

asgallant

unread,
Dec 20, 2012, 1:04:34 PM12/20/12
to google-visua...@googlegroups.com
If you do see flicker, you can modify the code slightly to check the "inProgress" status of the "statechange" event, and perform the redraw only if inProgress is false.

Yoram

unread,
Dec 23, 2012, 5:33:55 AM12/23/12
to google-visua...@googlegroups.com
Thanks for the help.
Reply all
Reply to author
Forward
0 new messages