Each 'serie' is a separate column of data. So if you have 3 series, you'll have 4 columns of data (1 for the x-axis, 1 for each of the 3 serie).
In your example, although you are defining colors for 6 series, you are assigning all values to the first 1 (since all your setValue() calls only target the 0th column -- for the x axis -- and the 1st column -- the values of the 1st serie). Have a look at this example instead and the comments contained in the source therein: http://savedbythegoog.appspot.com/?id=02b9d7a088bcdd8d95a4e9d7f0d8949a24c93edd - R. On 2 November 2011 20:39, AleRitty <[email protected]> wrote: > Hi! I need to set a specific colour (and/or point size) for each point > of my graph, I'm using this code (taken directly from the official > examples): > > [code] > google.load("visualization", "1", {packages:["corechart"]}); > google.setOnLoadCallback(drawChart); > function drawChart() { > var data = new google.visualization.DataTable(); > data.addColumn('number', 'Age'); > data.addColumn('number', 'Weight'); > data.addRows(6); > data.setValue(0, 0, 8); > data.setValue(0, 1, 12); > data.setValue(1, 0, 4); > data.setValue(1, 1, 5.5); > data.setValue(2, 0, 11); > data.setValue(2, 1, 14); > data.setValue(3, 0, 4); > data.setValue(3, 1, 4.5); > data.setValue(4, 0, 3); > data.setValue(4, 1, 3.5); > data.setValue(5, 0, 6.5); > data.setValue(5, 1, 7); > > var chart = new > google.visualization.ScatterChart(document.getElementById('chart_div')); > chart.draw(data, {width: 400, height: 240, > title: 'Age vs. Weight comparison', > hAxis: {title: 'Age', minValue: 0, maxValue: > 15}, > vAxis: {title: 'Weight', minValue: 0, > maxValue: 15}, > series: { > 0:{color: 'blue', pointSize: '3', > visibleInLegend: true}, > 1:{color: 'black', pointSize: '3', > visibleInLegend: true}, > 2:{color: 'red', pointSize: '3', > visibleInLegend: true}, > 3:{color: 'red', pointSize: '3', > visibleInLegend: true}, > 4:{color: 'red', pointSize: '3', > visibleInLegend: true}, > 5:{color: 'red', pointSize: '3', > visibleInLegend: true} > }, > legend: 'none' > }); > } > [/code] > > But in this way every point is blue. > If I change the value for the serie 0 from blue to black, every point > became black! > > Is possible to change the color of every point indipendently? > > -- > You received this message because you are subscribed to the Google Groups > "Google Visualization API" group. > To post to this group, send email to > [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/google-visualization-api?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Google Visualization API" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-visualization-api?hl=en.
