Color?

30 views
Skip to first unread message

Abigail T

unread,
Apr 8, 2019, 9:15:21 PM4/8/19
to Google Visualization API
I'm trying to change the color of the bars on my chart and can't figure out how to do it, could someone please help?

Andrian Fathurohman Permana

unread,
Apr 8, 2019, 10:25:33 PM4/8/19
to google-visua...@googlegroups.com
colors : ['red']

Pada tanggal Sel, 9 Apr 2019 pukul 08.15 Abigail T <tuep...@gmail.com> menulis:
I'm trying to change the color of the bars on my chart and can't figure out how to do it, could someone please help?

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-visualization-api/526b00a2-fd97-46c6-a2b6-9fd070cd90e4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ray Thomas

unread,
Apr 14, 2019, 12:27:26 AM4/14/19
to Google Visualization API
Andrian is absolutely correct but here's a fuller explanation.

The colors can be defined for any graph either in the Options section or in the main draw() method. The help for both is at https://developers.google.com/chart/interactive/docs/customizing_charts

The default color array for Google charts contains 32 colors. The first 21 of them are given at https://github.com/ankane/chartkick/issues/351

If there are more data points than colors then when the entire array is used then it starts from the beginning again. This also applies if you define your own array.

You can also define your own array anywhere inside the script and use that. For example

var clrArray=['#e0440e', '#e6693e', '#ec8f6e', '#f3b49f', '#f6c7b6']; 
colors: clrArray 

This is useful if for example you need to use more colorblind friendly colors.

There's several palette generators around, three are the ones at http://tools.medialab.sciences-po.fr/iwanthue/ and http://colorbrewer2.org/ and https://color.adobe.com/create/color-wheel/ 
Reply all
Reply to author
Forward
0 new messages