Different color pattern

20 views
Skip to first unread message

K.Pandi Rajan

unread,
Jul 18, 2020, 2:56:22 PM7/18/20
to Google Visualization API
Hi,
I can see same pattern for all charts, which starts from blue followed by red and other colors.
Is there any other option available to choose different pattern of colors for each chart.
Because I'm using multiple charts in single page all are same pattern.

I can see color customization for each item in data but I have dynamic set of data where I can't declare color initially.

Ray Thomas

unread,
Jul 18, 2020, 9:55:07 PM7/18/20
to Google Visualization API
You need to give an array of color in the options for each chart. That's explained on https://developers.google.com/chart/interactive/docs/customizing_charts

What happens is the same as for the default palette, if you have more data than you have defined colors for then they start again at the beginning. 

You can even give the array of colors a variable name in the code and use that in the color option.

usrClr = ['#7CB5EC','#434348','#90ED7D','#F7A35C','#8085E9','#F15C80','#E4D354','#2B908F','#F45B5B','#91E8E1','#2F7ED8','#0D233A','#8BBC21','#910000','#1AADCE','#492970','#F28F43','#77A1E5','#C42525','#A6C96A','#4572A7','#AA4643','#89A54E','#80699B','#3D96AE','#DB843D','#92A8CD','#A47D7C','#B5CA92','#4572A7'];

and then in the options section use

colors: usrClr,
Reply all
Reply to author
Forward
0 new messages