Histogram bucketSize option is ignored

63 views
Skip to first unread message

Emmanuel Schanzer

unread,
May 18, 2022, 3:27:55 PM5/18/22
to Google Visualization API
First off - thanks for this awesome library! 

Depending on the bounds of the data, the bucketSize option is ignored. Here's a simple jsfiddle which reproduces the issue.

We use this library in a national curriculum project that has tens of thousands of students - and this bug has been driving teachers and students crazy.

Any hope for a fix or workaround? I've read through prior conversations and numerous StackOverflow threads, and none of them seem to work.

Thanks in advance!
Emmanuel

Daniel LaLiberte

unread,
May 18, 2022, 3:46:17 PM5/18/22
to google-visua...@googlegroups.com
Hi Emmanuel,

Thanks for posting about this problem.  Glad to hear so many students are using Google Charts.

I believe what you are seeing is that the bucketSize option is not actually ignored.  If you change your example to set the option to each of 1, 2, 3, 4, and 5, you will see the chart changes, but it doesn't use the given bucketSize exactly unless it is close to a tick value.   Rather, it effectively rounds to the nearest tick value, or something similar to that.   I have to admit, this is a bug, since you should be able to specify any bucketSize value.  

I don't see any workaround at this time.  It is possible to specify options that determine the hAxis ticks, and those will be used, but only after the bucketing has been done.   If the  numBucketsRule allowed you to specify a function that you could provide to determine the number of buckets and thus the bucket size, that could also work.

But it will be easier, I expect, to just let the bucketSize option be used as specified.  I'll look into that.


--
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 view this discussion on the web visit https://groups.google.com/d/msgid/google-visualization-api/a3dc612d-0a5b-498b-abbb-031ba5c7bf61n%40googlegroups.com.


--

Daniel LaLiberte

 • SWE

 Cambridge MA

 • dlaliberte@Google.com

Emmanuel Schanzer

unread,
May 18, 2022, 6:28:13 PM5/18/22
to Google Visualization API
Thanks, Daniel - we're all crossing our fingers that there's an easy fix or a functional workaround that can be turned with minimal effort. Of course, we know it's never that easy, but a guy can dream, can't he?

Emmanuel Schanzer

unread,
May 26, 2022, 3:07:16 PM5/26/22
to Google Visualization API
Hi Daniel - just following up on this with fingers crossed. Does it look like this bug is fixable?

Emmanuel Schanzer

unread,
Jun 11, 2022, 12:20:45 PM6/11/22
to Google Visualization API
Hi Daniel - just following up on this. Any chance of a fix for this bug?

Daniel LaLiberte

unread,
Jun 12, 2022, 3:46:58 PM6/12/22
to google-visua...@googlegroups.com
Hi Emmanuel,

Sorry for the delay.  I've been preoccupied with other tasks.

I looked into the bug and possible fixes a couple weeks ago after your messages.  I didn't find an easy solution at that time, not without possible implications for always using the bucketSize option to override other options.  The change is probably simple, but the consequences are more complex.  So basically, more testing will be needed to make sure we are doing the right thing.  

If you want to help out, it would be great if you could set up a series of simple tests of the many combinations of options and data.  I can turn those into automated tests, and then we will have more confidence in whatever changes we decide to make.


Reply all
Reply to author
Forward
0 new messages