Do Histogram support hAxis ticks?

86 views
Skip to first unread message

Erik M

unread,
Oct 29, 2018, 5:41:14 PM10/29/18
to Google Visualization API
I am trying to have a custom tick label in my x-axis in a Histogram though it doesn't seem to work. I've tried:

hAxis: {
  ticks: [0,1,2,3,{v:5, f:'5+'}]
}

however that doesn't seem to work as ticks are not even being respected.

In reading the documentation, there is an example in https://developers.google.com/chart/interactive/docs/gallery/histogram#controlling-buckets which shows that ticks can be used for hAxis.

  var options = {
    title: 'Approximating Normal Distribution',
    legend: { position: 'none' },
    colors: ['#4285F4'],

    chartArea: { width: 401 },
    hAxis: {
      ticks: [-1, -0.75, -0.5, -0.25, 0, 0.25, 0.5, 0.75, 1] // <----- here 
    },
    bar: { gap: 0 },

    histogram: {
      bucketSize: 0.02,
      maxNumBuckets: 200,
      minValue: -1,
      maxValue: 1
    }
  };

If I scroll down to the configuration options section https://developers.google.com/chart/interactive/docs/gallery/histogram#configuration-options there's no such thing as hAxis.ticks, there is however, a vAxis.ticks. So is the example just outdated?

Is there any way I can have custom ticks with labels along the x-axis for Histograms?

Thanks for the help!

Daniel LaLiberte

unread,
Oct 29, 2018, 8:48:53 PM10/29/18
to google-visua...@googlegroups.com
The ticks option is supposed to work for the hAxis on the Histogram, but that feature got broken.  I'll be fixing it asap, along with several more fixes.

You should be able to get it working for now if you load an older version instead of 'current', such as the previous version which was 45.2.

--
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/3fad7d6b-8965-4181-9af8-64df03299d36%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--

Erik M

unread,
Oct 30, 2018, 2:22:16 PM10/30/18
to Google Visualization API
Setting it to 45.2 works, thanks! By the way is there a page with the available versions and release logs? Than you!

Daniel LaLiberte

unread,
Oct 30, 2018, 2:26:16 PM10/30/18
to google-visua...@googlegroups.com
There should be a link to it on the bottom of most pages.

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

Erik M

unread,
Oct 30, 2018, 2:27:24 PM10/30/18
to Google Visualization API
Thank you very much!


On Monday, October 29, 2018 at 2:41:14 PM UTC-7, Erik M wrote:
Reply all
Reply to author
Forward
0 new messages