Colors on Bars in BarChart

980 views
Skip to first unread message

Eduardo Diederichsen

unread,
Mar 27, 2012, 4:10:22 PM3/27/12
to Google Visualization API
Hi,

I'm using bar chart from google chart api, but I have a problem! I
have a bar chart with 2 columns and 6 rows and I have to set one color
for each row.
I just found a way to set the color of the first and of the second
column, but for each row, those colors repeat!


Someone can help me?


Thanks

asgallant

unread,
Mar 27, 2012, 4:22:57 PM3/27/12
to google-visua...@googlegroups.com
Bars are colored by series (column in the DataTable), so you have to have each color represented by its own series.  Search these forums for more details, as this has been covered extensively.

Eduardo Diederichsen

unread,
Mar 27, 2012, 5:23:19 PM3/27/12
to Google Visualization API
So, you know if I can have one serie for each row on my DataTable?

asgallant

unread,
Mar 28, 2012, 10:09:11 AM3/28/12
to google-visua...@googlegroups.com
No, series are by DataTable column only.  There are ways to work around the problem, however.  You can do things like this: http://jsfiddle.net/PXntw/ 

Unfortunately, there is no way to reduce the spacing between rows, as the chart has reserved space for the bars with no data.  Normally we get around this by setting the 'isStacked' option to true, but that won't work in your case, as you specifically want your grouped columns to be the same color, which would make them indistinguishable when stacked.
Reply all
Reply to author
Forward
0 new messages