ChartRangeFilter and BarChart workaround

82 views
Skip to first unread message

Petr

unread,
Mar 5, 2016, 5:54:16 AM3/5/16
to Google Visualization API
I need to combine ChartRangeFilter with BarChart. This is currently not supported, because CharRangeFilter works on continuous axis, while BarChart needs discrete x-axis.
On x-axis I have equidistant data ( January 2010, February 2010...)

My first step was to create data table with two  x-axis columns. The first column is continuous and the second one is string ("Jan 2010"). Then I do something like this:

ChartRangeFilter.setView({'columns': [0,2]});
BarChart.setView({'columns': [1,2]});

That is - to ChartRangeFilter I set continuous axis and to  BarChart column with discrete axis.
I see, that I can not bind the two chart by standard dashboard.bind, but I have to write my own hadler hoked on ChartRangeFilter statchange listener.

My problem is, how to set data to BarChart in the linstener handler. I know, how to find start and end of the ChartRangeFilter, but how to fiter the data table and pass it to the BarChart?

Thanks for any hint!

Daniel LaLiberte

unread,
Mar 7, 2016, 9:28:51 AM3/7/16
to Google Visualization API
Hi Petr,

First, the ColumnChart (which it sounds like you mean rather than BarChart) does work with continuous x values.   This is mentioned here:  https://developers.google.com/chart/interactive/docs/gallery/columnchart#data-format though we don't have many examples of how to use it.

But regardless, what you are trying to do with the view option for the chart range filter and column chart should work.  If you want to put together an example that shows what you are trying to do, we can look into it further.  However, you may not want to bother given the above.

Regarding your last question, if you want to pursue it, you can specify the row indices in a view as well.  Or you can specify a viewWindow min and max value to constrain what is visible.

--
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 google-visualizati...@googlegroups.com.
To post to this group, send email to google-visua...@googlegroups.com.
Visit this group at https://groups.google.com/group/google-visualization-api.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-visualization-api/06f85093-b078-41e9-8d0c-d8211d0a30e2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Reply all
Reply to author
Forward
0 new messages