Histogram rendering error

126 views
Skip to first unread message

Nick Laviola

unread,
Feb 26, 2018, 1:51:58 PM2/26/18
to Google Visualization API
I have a page displaying a series of histograms that all need to have the same number/size of buckets for easy comparisons. When I specify bucketSize however, I get rendering errors on some the charts:













I can remedy this by setting the hAxis: {type: 'category'} option, however this then prevents me from setting a number format for the hAxis ticks. I've tried reverting to earlier versions of the corechart, but to no avail.

Has anyone else experienced this problem? Can we possibly have this looked at for future versions?

Daniel LaLiberte

unread,
Feb 26, 2018, 1:57:24 PM2/26/18
to Google Visualization API
Hi Nick,

Have you tried the 'upcoming' version?  There are many changes in the axis ticks, but I am not sure how this might have impacted the histogram.

Nick Laviola

unread,
Feb 26, 2018, 2:23:46 PM2/26/18
to Google Visualization API
Hi Daniel, thanks for the quick reply. I gave that a shot (google.charts.load('upcoming', {packages: ['corechart']});) but I'm still seeing the same rendering issue. Here are my current chart options if that gives any insight:
var options = {
                        title: deviceLetter + ' device ' + testName + ' values',
                        legend: { position: 'none' },
                        colors: [chartColors[deviceLetter]],
                        height: 360,
                        histogram: {
                            bucketSize: bucketSize, //computed bucket size
                            minValue: min, //set by user
                            maxValue: max //set by user
                        },
                        hAxis: {format: '0.0E00', title: testName}
                };

Daniel LaLiberte

unread,
Feb 26, 2018, 2:31:24 PM2/26/18
to Google Visualization API
Are you computing your bucketSize value from (max - min) / 7?  You might want to round that result.

You say you only have problems with some charts, but you haven't said what rendering errors you are referring to.  What do you expect it to look like?

Could you set up a simple example on jsfiddle so we can be talking about the same thing, data included?  Thanks.

--
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.
To post to this group, send email to google-visualization-api@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/98242b7f-dc84-452b-953b-f99c17af18de%40googlegroups.com.

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



--

Nick Laviola

unread,
Feb 26, 2018, 8:33:24 PM2/26/18
to Google Visualization API
The rendering issue has to do with bars spanning multiple buckets, as shown in this fiddle: https://jsfiddle.net/s2j4asdp/47/. I expect it to look like this: https://jsfiddle.net/yft7c2w5/6/

Yes, the bucket size is computed exactly in that way. I will try rounding it, but the min/max values vary from containing several decimal places to large integers. I solved this by forcing a format of '0.0E00' on the hAxis, however in order to correct the rendering problem I had to resort to defining  hAxis: {type: 'category'} as shown in the second fiddle, which unfortunately negates the formatting rule I use. Notice if you add the option hAxis: {type: 'category'}, the rendering problem is solved, but you lose the formatting for the hAxis ticks. 
To post to this group, send email to google-visua...@googlegroups.com.



--

Nick Laviola

unread,
Mar 1, 2018, 3:20:27 PM3/1/18
to Google Visualization API
Any headway on this issue?

Daniel LaLiberte

unread,
Mar 3, 2018, 2:08:19 PM3/3/18
to Google Visualization API
I understand the problem now, and I have a fix in the works, which will be included in v46.

The problem is caused by the (erroneous) assumption that the zero counts for some buckets should be ignored when calculating the maximum allowed width of the bars.  You would not see this problem if there were at least 2 adjacent buckets with non-zero values because the widths for all buckets is computed from the maximum width that fits for all bars (ignoring those zero values).

Thanks for your patience.


To unsubscribe from this group and stop receiving emails from it, send an email to google-visualization-api+unsubscr...@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.



--

--
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.
To post to this group, send email to google-visualization-api@googlegroups.com.

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



--

Nick Laviola

unread,
Mar 4, 2018, 6:56:23 PM3/4/18
to Google Visualization API
No worries! Thank you for taking the time to work on this. 

-Nick
To unsubscribe from this group and stop receiving emails from it, send an email to google-visualization-api+unsub...@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.



--

--
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.
To post to this group, send email to google-visua...@googlegroups.com.
Visit this group at https://groups.google.com/group/google-visualization-api.



--

Sorawee Porncharoenwase

unread,
Jul 19, 2018, 3:38:22 PM7/19/18
to Google Visualization API
Hello Daneil,

Is there any progress on this? I just tried a very straightforward example and still found the issue: https://jsfiddle.net/toa1e3kp/7/

Of course, changing the maxNumBuckets to 300 would solve the problem as you said, but I also would like to know the current status of the fix.

Thanks!

Daniel LaLiberte

unread,
Jul 19, 2018, 4:02:13 PM7/19/18
to Google Visualization API
Sorry, I have been tied up with deadlines in my previous team, and new deadlines in the current team (stackdriver charts).  

When I left this a few months ago, I had finished most of the refactoring I was doing of Histogram, which involved using the axis tick generation code to compute buckets, but I have to get log scales (on vertical axis) working again.  And then I have more testing.. and who knows what else I might find.

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


--

Sorawee Porncharoenwase

unread,
Jul 20, 2018, 1:42:28 PM7/20/18
to Google Visualization API
Hi Daniel,

I perfectly understand that you have other work to do. That said, do you have a rough estimation for when this will be fixed? We designed a data science course (http://www.bootstrapworld.org/materials/data-science/) which uses Google Charts for visualization, and students will use it around the middle of August. As students will use their own dataset, we can't make sure that there will be two adjacent buckets, so the bug might occur which would confuse students.

If the fix won't roll out by the middle of August, could you provide any workaround that you can think of? Also, let me know if you accept a patch. I would be willing to contribute.

Thanks!

Daniel LaLiberte

unread,
Sep 20, 2018, 5:03:25 PM9/20/18
to Google Visualization API
Nick and Sorawee,

The new 'upcoming' version has a lot of changes to better support histograms.  I am curious how well it will meet your needs.

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


--

Nick Laviola

unread,
Sep 20, 2018, 6:43:31 PM9/20/18
to Google Visualization API
Thanks so much! I'll switch to that version to test and report back with any issues. 


On Thursday, September 20, 2018 at 2:03:25 PM UTC-7, Daniel LaLiberte wrote:
Nick and Sorawee,

The new 'upcoming' version has a lot of changes to better support histograms.  I am curious how well it will meet your needs.

On Fri, Jul 20, 2018 at 1:42 PM Sorawee Porncharoenwase <sorawe...@gmail.com> wrote:
Hi Daniel,

I perfectly understand that you have other work to do. That said, do you have a rough estimation for when this will be fixed? We designed a data science course (http://www.bootstrapworld.org/materials/data-science/) which uses Google Charts for visualization, and students will use it around the middle of August. As students will use their own dataset, we can't make sure that there will be two adjacent buckets, so the bug might occur which would confuse students.

If the fix won't roll out by the middle of August, could you provide any workaround that you can think of? Also, let me know if you accept a patch. I would be willing to contribute.

Thanks!

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

Nick Laviola

unread,
Sep 25, 2018, 7:25:01 PM9/25/18
to Google Visualization API
Daniel, the 'upcoming' version appears to have rectified the issue with the bucket size rendering! My rendered histograms behave as expected now. Thank you so much for your support on this issue. If you need any additional feedback please let me know.

-Nick


On Thursday, September 20, 2018 at 2:03:25 PM UTC-7, Daniel LaLiberte wrote:
Nick and Sorawee,

The new 'upcoming' version has a lot of changes to better support histograms.  I am curious how well it will meet your needs.

On Fri, Jul 20, 2018 at 1:42 PM Sorawee Porncharoenwase <sorawe...@gmail.com> wrote:
Hi Daniel,

I perfectly understand that you have other work to do. That said, do you have a rough estimation for when this will be fixed? We designed a data science course (http://www.bootstrapworld.org/materials/data-science/) which uses Google Charts for visualization, and students will use it around the middle of August. As students will use their own dataset, we can't make sure that there will be two adjacent buckets, so the bug might occur which would confuse students.

If the fix won't roll out by the middle of August, could you provide any workaround that you can think of? Also, let me know if you accept a patch. I would be willing to contribute.

Thanks!

--
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,
Sep 25, 2018, 8:21:45 PM9/25/18
to Google Visualization API
That's great to hear.  Thanks for your help testing this out.

It would be great if we could get more people to try out their charts by changing to the 'upcoming' version, especially anyone who is dependent on precise alignment of ticks.  There were a lot of changes to all the tick generation, and I would be surprised if there are not at least a few surprises lurking.

On Tue, Sep 25, 2018 at 7:25 PM Nick Laviola <ni...@praevium.com> wrote:
Daniel, the 'upcoming' version appears to have rectified the issue with the bucket size rendering! My rendered histograms behave as expected now. Thank you so much for your support on this issue. If you need any additional feedback please let me know.

-Nick

On Thursday, September 20, 2018 at 2:03:25 PM UTC-7, Daniel LaLiberte wrote:
Nick and Sorawee,

The new 'upcoming' version has a lot of changes to better support histograms.  I am curious how well it will meet your needs.

On Fri, Jul 20, 2018 at 1:42 PM Sorawee Porncharoenwase <sorawe...@gmail.com> wrote:
Hi Daniel,

I perfectly understand that you have other work to do. That said, do you have a rough estimation for when this will be fixed? We designed a data science course (http://www.bootstrapworld.org/materials/data-science/) which uses Google Charts for visualization, and students will use it around the middle of August. As students will use their own dataset, we can't make sure that there will be two adjacent buckets, so the bug might occur which would confuse students.

If the fix won't roll out by the middle of August, could you provide any workaround that you can think of? Also, let me know if you accept a patch. I would be willing to contribute.

Thanks!

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


--
Reply all
Reply to author
Forward
0 new messages