Hi Josh, I'm not 100% sure what you mean by "labels." I assume that you mean annotations, as demonstrated here<https://developers.google.com/chart/interactive/docs/roles#annotationrole>. The role "label" is not a valid role and will not be recognized by the chart. As was said in the StackOverflow thread, annotations are not supported for ScatterCharts. You can remedy this by instead creating a LineChart and setting its pointSize option to something reasonable (like 5) and setting the lineWidth to 0. The only caveat here would be that your domain has to be sorted, unlike in a ScatterChart.
- Sergey On Tue, Feb 26, 2013 at 12:13 PM, Joshua McGinnis <[email protected]> wrote: > I'm trying to get my scatter plot to show the labels automatically and > despite turning it on, it doesn't show them. I can only get tooltips to > work. > > Any thoughtsL? > > I've also posted this question here with the source: > > http://stackoverflow.com/questions/15094892/unable-to-show-labels-in-google-scatter-chart > > > Here is my draw method: > > drawChart: function() { > var self = this; > > var gdpMin = parseFloat(self.scores[0].gdpScore); > var gdpMax = gdpMin; > var teaMin = parseFloat(self.scores[0].teaScore); > var teaMax = teaMin; > > var data = new google.visualization.DataTable(); > data.addColumn('number', 'GDP Score'); > data.addColumn('number', 'TEA Score'); > data.addColumn({type:'string', role:'label'}); > > $.each(self.scores, function(i, score) { > gdpScore = parseFloat(score.gdpScore); > teaScore = parseFloat(score.teaScore); > data.addRows([[gdpScore, teaScore, score.partner]]); > if (gdpScore < gdpMin) gdpMin = gdpScore; > if (gdpScore > gdpMax) gdpMax = gdpScore; > if (teaScore < teaMin) teaMin = teaScore; > if (teaScore > teaMax) teaMax = teaScore; > }); > > var options = { > title: 'GDP and TEA Scores', > hAxis: {title: 'GDP', minValue: gdpMin, maxValue: gdpMax}, > vAxis: {title: 'TEA', minValue: teaMin, maxValue: teaMax}, > legend: 'none', > colors: ['#3B7CBF'] > }; > > var chart = new > google.visualization.ScatterChart(document.getElementById('chart_div')); > chart.draw(data, options); > > -- > 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 [email protected]. > To post to this group, send email to > [email protected]. > Visit this group at > http://groups.google.com/group/google-visualization-api?hl=en. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- 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 [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/google-visualization-api?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
