How to change color of single bar dynamically in combo chart?

24 views
Skip to first unread message

Sujata Nipane

unread,
Dec 27, 2018, 5:55:22 AM12/27/18
to Google Visualization API
I have json response which has color value. So according to that value I want to change the color of combo chart bar.  There will be multiple value in json.

My Json is like this:
[{"colors":"#dd2727","availability":"Sold","plotno":"21","visits":"61","average":11,"start":"2018-12-27","end":"2018-11-27"},
{"colors":"#4c9e12","availability":"Available","plotno":"22","visits":"41","average":11,"start":"2018-12-27","end":"2018-11-27"}]

So I want to apply the colors value i.e  "#dd2727"  to first bar and "#4c9e12" to second bar. How to do this? How can I pass different colors value inside options colors.

Please help me ASAP.

yassin azouzi

unread,
Dec 27, 2018, 6:02:02 AM12/27/18
to Google Visualization API
use this form
 var data = google.visualization.arrayToDataTable([
         ['Element', 'Density', { role: 'style' }, { role: 'annotation' } ],
         ['Copper', 8.94, '#b87333', 'Cu' ],
         ['Silver', 10.49, 'silver', 'Ag' ],
         ['Gold', 19.30, 'gold', 'Au' ],
         ['Platinum', 21.45, 'color: #e5e4e2', 'Pt' ]
      ]);

yassin azouzi

unread,
Dec 27, 2018, 6:02:42 AM12/27/18
to Google Visualization API


Le jeudi 27 décembre 2018 11:55:22 UTC+1, Sujata Nipane a écrit :

Sujata Nipane

unread,
Dec 27, 2018, 6:26:02 AM12/27/18
to Google Visualization API
I am working on combo chart. Please see the attachment.  there are different plot numbers at bottom and each plot number has different colors, as I have shown in JSON. How can I apply that to bars?
screen.png

yassin azouzi

unread,
Dec 27, 2018, 6:35:54 AM12/27/18
to google-visua...@googlegroups.com
suit les tutos 
apres les datas inserer votre couleur

--
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/460673ef-55e3-48cd-afd6-6b1f2b197313%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
   ***Azouzi Yassin***
Reply all
Reply to author
Forward
0 new messages