Set colors for multiple google charts

24 views
Skip to first unread message

del...@knowledgefoundry.com

unread,
Oct 20, 2015, 6:18:00 AM10/20/15
to Google Visualization API
Hi there,
I have a page with a pie chart and a bar chart referencing amount of users per country.
I need to ensure the color references are the same for the countries in both charts so that when I user a filter South Africa will always be in blue and Zimbabwe will always be in Yellow (for example)
Any help would be greatly appreciated.
Della

Sergey Grabkovsky

unread,
Oct 20, 2015, 10:57:02 AM10/20/15
to Google Visualization API
Hi Della,

I'm afraid we don't support syncing colors like that. Depending on how your user filtering works, you might have to do different things. For example, if you're using the Google Charts Controls, those will actually remove the row from the DataTable that the chart sees, so there isn't any sensible way to reassign the colors for things appearing after the series you want to hide.

However, if you have a custom filter, then there might be a possible solution:
On a line chart, you can hide the series by changing its visibleInLegend option and setting the color to 'none' or 'transparent', and on the pie chart, you can hide a series by simply setting its value to 0. This automatically removes it from the legend as well.

--
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 http://groups.google.com/group/google-visualization-api.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-visualization-api/286f1d54-fac7-4a60-9c60-de5e6f99808d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages