Re: RangeSelector vs. ChartRangeFilter

372 views
Skip to first unread message

asgallant

unread,
Aug 22, 2012, 3:59:01 PM8/22/12
to google-visua...@googlegroups.com
Where did you find information on a "RangeSelector" control?  I haven't seen any mention of one (though experimental evidence seems to suggest that the control does exist, I just can't get it to work).

You can make this work by using a ChartRangeFilter.  Set up a "statechange" event handler for the control.  In the handler, call the #getState method of the control - this returns an object with range.start and range.end properties.  Use those values to filter your data table into a DataView, and then group the view into a new DataTable that you use to draw the GeoChart.  Here's an example: http://jsfiddle.net/asgallant/Fs3Hb/

On Wednesday, August 22, 2012 10:40:37 AM UTC-4, Lionel Garnier wrote:
Hello,

I am trying to make a page with a geo chart and a selector showing the overall evolution by month.
The geochart is here to show overall sales value by region.
The selector will let the possibility to filter based on a time interval (can be up to several years).

As the time is not visible in the Geochart (consolidated data over the selected period), I cannot use a "dashboard" (if I understood properly).

So I am now doing it manually...


I first tried with a ChartRangeFilter, but I don't know how to retrieve the selected min and max after change.
=> I used the event 'statechange' but then how can I get the min value in the function that is called?

I then used a RangeSelector and it works fine. But I don't know how to set the minimum range size (to one month for example).
=> Is it possible?
I could't find any documentation on the RangeSelector, so I don't even know if this is an official control..!


Do anyone has a solution for one of my two problems?
Thanks in advance for your feed back

Lionel Garnier

unread,
Aug 23, 2012, 2:43:26 AM8/23/12
to google-visua...@googlegroups.com
Excellent! You are solving two of my issues :)
Thanks a lot

Nevertheless, just one thing is differing from what I want: I would like the graph of the ChartRangeFilter to show the overall sales per month.
But don't worry, I know how I can do it... I will do it without using a dashboard.


Regarding the RangeSelector, I simply adapted the code that I found behind this page:  http://google-visualization-io2011.googlecode.com/hg/iframes/geo/xkcd_dilbert.html  :P
After a few tries I could work with it.


Thanks again for your quick answer

asgallant

unread,
Aug 23, 2012, 12:37:01 PM8/23/12
to google-visua...@googlegroups.com
Ahh...I think that was just an early version of the ChartRangeFilter.  In any event, they used almost the exact same method I did to aggregate values over time.

If you group the main dataTable by date, you can pass that grouped data to the filter instead of the main dataTable.  Remove the "view" parameter in the control and it will draw the monthly totals: http://jsfiddle.net/asgallant/GAcab/2/ 

Note that depending on how your dates are input (ex, all the January data has different days of the month, or something like that) you may need to use a modifier function on column 0 when you group the data (see here for instructions).

Lionel Garnier

unread,
Aug 23, 2012, 1:23:01 PM8/23/12
to google-visua...@googlegroups.com
Whaou! That's a very nice solution!!
Thanks a lot once again :)

asgallant

unread,
Aug 23, 2012, 1:52:47 PM8/23/12
to google-visua...@googlegroups.com
You're welcome.

Pedro Guimarães

unread,
Nov 19, 2012, 11:40:18 AM11/19/12
to google-visua...@googlegroups.com
Hi there,

How can I fill those dates with mysql ?
I'm getting trouble in that.


asgallant

unread,
Nov 19, 2012, 3:05:29 PM11/19/12
to google-visua...@googlegroups.com
There are a number of ways of getting data from MySQL to the charts; what script language are you working with?

Pedro Guimarães

unread,
Nov 19, 2012, 3:12:11 PM11/19/12
to google-visua...@googlegroups.com
Im using PHP (:
Reply all
Reply to author
Forward
Message has been deleted
0 new messages