I am using the Google charts API. Is there a way to hide the legend for a scatter plot?
Asked
Active
Viewed 1.1e+01k times
5 Answers
402
You can disable the legend by using 'none' as the position:
legend: {position: 'none'}

Trevor Pesout
- 4,052
- 1
- 14
- 3
-
22This actually works. Haven't tried the other suggestion. Remember should go in the options: `var options = {legend:{position:'none'}};` – o01 Feb 07 '12 at 22:28
-
This removes the title too! – atreat Aug 15 '14 at 19:18
-
This is exactly what i was looking for, remove all legends etc, work on visualization version 1 "google.load("visualization", "1", { packages: ["bar"] });" – Vasil Valchev Jun 10 '15 at 12:23
-
8Google's documentation on charts is so bad. – John R Perry Dec 04 '17 at 17:04
97
A bit cleaner way is
legend: 'none'

dimus
- 8,712
- 10
- 45
- 56
-
Still working for me today (17/009/2015). I'm using "google.load('visualization', '1.1', {'packages':['controls', "corechart", "calendar"]});" – Strabek Sep 17 '15 at 09:47
-
This didn't work for me on 07.10.2016 (dd.mm.yyyy), although the original accepted answer worked. – Jonas Grumann Oct 07 '16 at 14:59
-
Doesn't work for me on September 23, 2017. The accepted answer works. – Louis Dionne Sep 23 '17 at 22:32
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'}}

Jhonny Pamponet
- 83
- 1
- 9
-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