I would like to display multiple colors (and potentially shapes and sizes) of data points in a Google Chart scatter chart. Does anyone have an example of how to do so?


Kent Beck

+2  A: 

You can only use one dataset in a scatter plot, thus only one color.

From the API description:

Scatter plots use multiple data sets differently than other chart types. You can only show one data set in a scatter plot.

+1  A: 

You could effectively fake a multi-color scatter plot by using a line plot with white lines and colored shape markers at the points you want to display.

+4  A: 

I answered my own question after waiting SECONDS for an answer here :-)

You can indeed have different colors for different data elements. For example:,2,3|6,5,4&chds=1,3,0,10&chxt=x,y&chxl=0:|0|1|2|1:|0|10&chm=d,ff0000,0,0,8,0|a,ff8080,0,1,42,0|c,ffff00,0,2,16,0

It's the chm= that does the magic. I was trying to have multiple chm= statements. You need to have just one, but with multiple descriptions separated by vertical bars.

Kent Beck
Awesome, Thanks! I would not have thought of using the chm that way.

Here's another example: twitter charts. I'm hoping to do the same thing. Need to find out how to do the concentric circles.