Re: Edit colors dynamically

45 views
Skip to first unread message
Message has been deleted

Lumière

unread,
Aug 7, 2012, 12:30:11 PM8/7/12
to google-visua...@googlegroups.com
I also tried this:
       colors: ['black','blue','white','blue','blue','blue','blue']

But none of the above work.

asgallant

unread,
Aug 7, 2012, 2:27:53 PM8/7/12
to google-visua...@googlegroups.com
You can only color data by series.  If you want different colors for bars, you have to assign those values to different series, which can be handled with a DataView using calculated columns.  You then need to set the "isStacked" option to true and draw the chart based on the DataView.  I wrote a demo script for this that you can base your's off of: http://jsfiddle.net/asgallant/QHJA6/ 

Lumière

unread,
Aug 7, 2012, 3:13:40 PM8/7/12
to google-visua...@googlegroups.com
I like your code! But how do you choose the colors?

asgallant

unread,
Aug 7, 2012, 3:35:18 PM8/7/12
to google-visua...@googlegroups.com
Set the "colors" option (like you did below); each element in the array corresponds to a data series (so with the array below, the first series would be black, the second blue, etc).

Lumière

unread,
Aug 7, 2012, 3:54:30 PM8/7/12
to google-visua...@googlegroups.com
It works perfectly. Thank you so much!

asgallant

unread,
Aug 7, 2012, 4:06:46 PM8/7/12
to google-visua...@googlegroups.com
You're welcome.
Reply all
Reply to author
Forward
0 new messages