Setting Histogram Horizontal Axis Groupings

82 views
Skip to first unread message

Jeff Mackewicz

unread,
Dec 12, 2013, 2:49:06 AM12/12/13
to google-visua...@googlegroups.com
I have a histogram and I'm trying to define the groupings/values to be shown as part of the horizontal axis.  Is there a way to specify the range of values for each bar or at least the number of groupings for the axis.  As an example, for the following chart, I'd like to just have four groupings.


asgallant

unread,
Dec 12, 2013, 9:48:26 AM12/12/13
to google-visua...@googlegroups.com
The histogram chart doesn't have an option to set the intervals to use for grouping, but it really should.  I filed a feature request for this: http://code.google.com/p/google-visualization-api-issues/issues/detail?id=1413.  You can "star" the issue to get updates on it.

Jon Orwant

unread,
Dec 12, 2013, 9:50:22 AM12/12/13
to google-visua...@googlegroups.com
A histogram.bucketSize option is coming soon.

Jon


--
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 http://groups.google.com/group/google-visualization-api.
For more options, visit https://groups.google.com/groups/opt_out.

debe...@indiana.edu

unread,
Jan 17, 2016, 7:44:34 PM1/17/16
to Google Visualization API
In addition to bucket size we need to be able to fix the max and min values regardless of the values in the data set. There are times when one wants to keep the horizontal axis scaling the same to better identify differences between data sets with different number of data points.

Daniel LaLiberte

unread,
Jan 18, 2016, 5:24:52 PM1/18/16
to Google Visualization API
Hi debeeker,

I am actually adding support for specifying the min and max values of the Histogram domain axis, as well as a number of other features.  This should be available in the next release, if not the upcoming one, perhaps within a couple weeks.

--
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.

debe...@indiana.edu

unread,
Jan 18, 2016, 7:44:16 PM1/18/16
to Google Visualization API
Daniel,

Thanks for the quick reply. As it turns out I tried the following (haxis:viewWindow:) and it appears it gives the result I needed:

 var options = {
          title: 'Random Gaussian Values',
          legend: { position: 'none' },
          hAxis: {
            viewWindow: {
                min: -3,
                max: 3
            }
          },
          histogram: { bucketSize: 0.05 }
         
        };

The only thing I noticed is occasionally, depending on the data, the axis labels at the limits alternate between -3.0 and 3.0 to -2.8 and 2.8 though the axis stays calibrated at -3 and +3 if that makes any sense.

It will take me a while to get used to the syntax. I would love to see some examples where one loads data is in a javascript array into the datatable object or whatever you call it in google Visualization. But that is a topic for another thread and I probably need to spend some time just reading the documentation and working through some examples.. 



On Monday, January 18, 2016 at 5:24:52 PM UTC-5, Daniel LaLiberte wrote:
Hi debeeker,

I am actually adding support for specifying the min and max values of the Histogram domain axis, as well as a number of other features.  This should be available in the next release, if not the upcoming one, perhaps within a couple weeks.
On Sun, Jan 17, 2016 at 7:44 PM, <debe...@indiana.edu> wrote:
In addition to bucket size we need to be able to fix the max and min values regardless of the values in the data set. There are times when one wants to keep the horizontal axis scaling the same to better identify differences between data sets with different number of data points.

On Thursday, December 12, 2013 at 2:49:06 AM UTC-5, Jeff Mackewicz wrote:
I have a histogram and I'm trying to define the groupings/values to be shown as part of the horizontal axis.  Is there a way to specify the range of values for each bar or at least the number of groupings for the axis.  As an example, for the following chart, I'd like to just have four groupings.


--
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-visualization-api+unsub...@googlegroups.com.



--

Daniel LaLiberte

unread,
Jan 18, 2016, 10:34:35 PM1/18/16
to Google Visualization API
Although the viewWindow min and max will constrain how the axis is drawn, there is no way now to specify that you want the histogram data to range from a minValue to a maxValue, and that is what I am adding.

There are a variety of ways to construct the data for a chart.  A good place in the documentation to start is https://developers.google.com/chart/interactive/docs/datatables_dataviews

On Mon, Jan 18, 2016 at 7:44 PM, <debe...@indiana.edu> wrote:
Daniel,

Thanks for the quick reply. As it turns out I tried the following (haxis:viewWindow:) and it appears it gives the result I needed:

 var options = {
          title: 'Random Gaussian Values',
          legend: { position: 'none' },
          hAxis: {
            viewWindow: {
                min: -3,
                max: 3
            }
          },
          histogram: { bucketSize: 0.05 }
         
        };

The only thing I noticed is occasionally, depending on the data, the axis labels at the limits alternate between -3.0 and 3.0 to -2.8 and 2.8 though the axis stays calibrated at -3 and +3 if that makes any sense.

It will take me a while to get used to the syntax. I would love to see some examples where one loads data is in a javascript array into the datatable object or whatever you call it in google Visualization. But that is a topic for another thread and I probably need to spend some time just reading the documentation and working through some examples.. 



On Monday, January 18, 2016 at 5:24:52 PM UTC-5, Daniel LaLiberte wrote:
Hi debeeker,

I am actually adding support for specifying the min and max values of the Histogram domain axis, as well as a number of other features.  This should be available in the next release, if not the upcoming one, perhaps within a couple weeks.
On Sun, Jan 17, 2016 at 7:44 PM, <debe...@indiana.edu> wrote:
In addition to bucket size we need to be able to fix the max and min values regardless of the values in the data set. There are times when one wants to keep the horizontal axis scaling the same to better identify differences between data sets with different number of data points.

On Thursday, December 12, 2013 at 2:49:06 AM UTC-5, Jeff Mackewicz wrote:
I have a histogram and I'm trying to define the groupings/values to be shown as part of the horizontal axis.  Is there a way to specify the range of values for each bar or at least the number of groupings for the axis.  As an example, for the following chart, I'd like to just have four groupings.


--
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.



--

--
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.

For more options, visit https://groups.google.com/d/optout.



--

Dan Beeker

unread,
Jan 19, 2016, 8:44:48 PM1/19/16
to google-visua...@googlegroups.com
Daniel,

You are totally correct. I don’t know what I was thinking when I said changing the axis labels would affect the data. Clearly I wasn’t thinking. I am looking forward to your improvements in the histogram.

Dan

Dan Beeker
Physics Department Lab Coordinator
Indiana University


You received this message because you are subscribed to a topic in the Google Groups "Google Visualization API" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-visualization-api/9fkWFSQTVIE/unsubscribe.
To unsubscribe from this group and all its topics, 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.
Reply all
Reply to author
Forward
0 new messages