Control spacing between bars in ColumnChart?

28,504 views
Skip to first unread message

Michael Kleber

unread,
Oct 18, 2011, 7:14:26 AM10/18/11
to google-visua...@googlegroups.com
Hi Visualization folks,

Is there a way to control the horizontal spacing between bars in a Column Chart?  I'm trying to draw a histogram, so I want the bars all pressed up right next to each other.



I had expected some Visualization option that controlled what fraction of the bar width was used as the inter-bar gutter, which I was prepared to set to 0.  But I'm failing to find it, if it exists.

--Michael

sylvainhugues

unread,
Oct 18, 2011, 10:33:19 AM10/18/11
to google-visua...@googlegroups.com
Thanks, s been solved !!!

Kosio

unread,
Oct 19, 2011, 4:26:56 AM10/19/11
to Google Visualization API
May I ask how?

Michael Kleber

unread,
Oct 20, 2011, 11:22:33 AM10/20/11
to google-visua...@googlegroups.com
Huh?  I'm the original poster, and I haven't heard any answer to this question!

Anyone know if this is possible?

asgallant

unread,
Oct 20, 2011, 1:08:21 PM10/20/11
to google-visua...@googlegroups.com
There's no support in the API for controlling the spacing between bars.  You might be able to hack it if you're willing to dig into the chart's SVG.

Geoffrey Zheng

unread,
Feb 15, 2013, 10:32:37 AM2/15/13
to google-visua...@googlegroups.com
But there is no way to set a fixed bar width AND control the spacing between the groups of bars, since they use the same option?

On Friday, July 27, 2012 8:41:52 AM UTC-4, Chris wrote:
Thanks Vicent. That helps in my case.

On Monday, July 23, 2012 8:03:53 PM UTC-3, Vincent Fu wrote:
I have used the option "bar{groupWidth'100%'}" to nearly eliminate all of the space between bars.

asgallant

unread,
Feb 15, 2013, 10:55:03 AM2/15/13
to google-visua...@googlegroups.com
The API allots (chartArea width / number of potential bar groups) pixel per bar group, and sets the group width based on that.  The bar group occupies the entire allotment, even though the bars may be drawn in a smaller area; the "spacing" between bar groups is simply the unused portion of the allotment. 

You can override the automatic group width determination with the bar.groupWidth option, but once you do that, the only way to affect the spacing between groups is to change either the chart's width or chartArea.width options (or both) to increase or decrease the allotted space per bar group.

Laura S

unread,
Feb 7, 2018, 10:21:24 AM2/7/18
to Google Visualization API
Could you please repeat in English?

Daniel LaLiberte

unread,
Feb 7, 2018, 1:39:09 PM2/7/18
to Google Visualization API
I'm not sure exactly what was true in 2013, but the bar width and gap options have changed more recently.   You can now control the bar.width and bar.gap separately from the bar.group.width and bar.group.gap.  bar.groupWidth should also work, in a mostly backward compatible way.  If you over-specify the options, when combined with your chartArea width (or height, if you switch the orientation), then you might not get exactly what you want.

Note that a bar group consists of all the bars of one or more series that have the same domain value, hence they are grouped side-by-side and separated from adjacent bar groups by the bar.group.gap.

Hope that helps.


--
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/54a6a8f3-6594-4290-abfd-a306a3ec80a6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

Gilberto Cuba Ricardo

unread,
Feb 18, 2018, 2:32:57 PM2/18/18
to Google Visualization API
Hi Daniel,


I'm not sure exactly what was true in 2013, but the bar width and gap options have changed more recently.   You can now control the bar.width and bar.gap separately from the bar.group.width and bar.group.gap.  bar.groupWidth should also work, in a mostly backward compatible way.  If you over-specify the options, when combined with your chartArea width (or height, if you switch the orientation), then you might not get exactly what you want.

Note that a bar group consists of all the bars of one or more series that have the same domain value, hence they are grouped side-by-side and separated from adjacent bar groups by the bar.group.gap.

How do you know that new feature, and where you look for that new update?
I spend some time, close a month, trying to add a little space between columns of the same serie or category.
I am using "angular-google-chart/ng-google-chart" library, and when I put this setup inside options it doesn't work as expected. Any suggestion?

Best regards,
GCR
Reply all
Reply to author
Forward
0 new messages