172

I am using the Google charts API. Is there a way to hide the legend for a scatter plot?

Kara
  • 6,115
  • 16
  • 50
  • 57
jamesatha
  • 7,280
  • 14
  • 37
  • 54

5 Answers5

402

You can disable the legend by using 'none' as the position:

legend: {position: 'none'}

Trevor Pesout
  • 4,052
  • 1
  • 14
  • 3
97

A bit cleaner way is

legend: 'none'
dimus
  • 8,712
  • 10
  • 45
  • 56
12
var options = {
               title: 'USA City Distribution',
               legend: 'none'
              };

In drawChart() function, Add legend: none property in your chart options object

Nilesh Bunde
  • 157
  • 1
  • 6
3

In my case I use:

library: {legend:{position:'none'}}

pie_chart @type_values,library: {legend:{position:'none'}}

-7

It doesn't appear so from the API, you can only set a position, with no option for "none". You could probably remove it with javascript though, if you can identify the containing element.

Edit: it actually appears as though you can omit the chdl= parameter to get a scatter without a legend.

Brandon Frohbieter
  • 17,563
  • 3
  • 40
  • 62