x axis range

70 views
Skip to first unread message

Matt

unread,
Oct 28, 2011, 6:05:37 PM10/28/11
to Google Visualization API
I'm plotting bucketed data that looks like a bell curve. Works just
fine; who doesn't love bell curves? With bell curve data, outlier
data on either side can make the graph look less 'pretty'. I;ve been
pouring over the Configuration Options here:
http://code.google.com/apis/chart/interactive/docs/gallery/areachart.html

My question: Is there a way to adjust the range of the x axis .....
say, give a max and min? I know I could just send fewer rows to the
graph, but that will be a pain with the data I have.

Roni Biran

unread,
Oct 30, 2011, 4:41:41 AM10/30/11
to google-visua...@googlegroups.com
in regard to xAxis, there is no min/max value. however, you can use the NumberRangeFilter.

--
You received this message because you are subscribed to the Google Groups "Google Visualization API" group.
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,
Oct 31, 2011, 9:01:32 AM10/31/11
to google-visua...@googlegroups.com
You can create a DataView from the DataTable, use the DataView#hideRows() method to hide your outliers, and then draw the chart from the view.  Eg: 

/*  assumes:
 *    data is a DataTable object
 *    chart is a chart object
 *    options is an option object to pass to the chart
 */
var view new google.visualizations.DataView(data);
// hide the first 3 and last 3 points (outliers)
view.hideRows(02);
view.hideRows(data.getNumberOfRows(3data.getNumberOfRows(1);
chart.draw(viewoptions);

Matt

unread,
Oct 31, 2011, 7:33:53 PM10/31/11
to Google Visualization API
Roni and asgallant, thank you for the comments. I like the slider
idea, I am going to give that a try and followup. Should work well for
the user as he/she should be able to clip data at both ends with just
two slides.

On Oct 30, 1:41 am, Roni Biran <roni.bi...@gmail.com> wrote:
> in regard to xAxis, there is no min/max value. however, you can use the
> NumberRangeFilter.
> here is a small sample that you can play with:http://code.google.com/apis/ajax/playground/?type=visualization#numbe...
>
>
>
>
>
>
>
> On Sat, Oct 29, 2011 at 12:05 AM, Matt <mhe...@kixeye.com> wrote:
> > I'm plotting bucketed data that looks like a bell curve.  Works just
> > fine; who doesn't love bell curves?  With bell curve data, outlier
> > data on either side can make the graph look less 'pretty'.  I;ve been
> > pouring over the Configuration Options here:
> >http://code.google.com/apis/chart/interactive/docs/gallery/areachart....

Matt

unread,
Oct 31, 2011, 8:22:40 PM10/31/11
to Google Visualization API
The one big hangup is that my AreaChart demands the first column
(xaxis) be a string, while the control filter expects to see numeric
values because I am using the number filter:
'controlType': 'NumberRangeFilter',

Jinji

unread,
Nov 1, 2011, 6:48:16 AM11/1/11
to google-visua...@googlegroups.com
This is still undocumented, but you can specify strictFirstColumnType: true in the options (this will be the default in just a couple of months), and then have an AreaChart with numbers in first column. After you do that, you can use hAxis.viewWindow in a similar way to vAxis.viewWindow.

Hope this helps.

asgallant

unread,
Nov 1, 2011, 9:38:16 AM11/1/11
to google-visua...@googlegroups.com
Filter on the data column, not the axis column.

Matt

unread,
Nov 1, 2011, 2:14:26 PM11/1/11
to Google Visualization API
Jinji, thank you for uncovering something not in the doc. I got my
solution working, utilizing asgallant's recommendation for using a
DataView that hides columns when a user enters a min and max that they
choose. Version 2 may eventually use the strictFirstColumnType with
the Dashboard. So I will have used a touch of everyone's solution,
thanks all!
Reply all
Reply to author
Forward
0 new messages