How do I remove the legend from a Google geoChart?

climboid picture climboid · Nov 19, 2011 · Viewed 17.3k times · Source

How do I remove the legend that appears in the bottom of the Google geoChart? I know that if I don't pass data.setValue to the chart object it wont show, but I need them to populate the map. All I want to do is get rid of the colors. Any ideas?

Answer

OldTinfoil picture OldTinfoil · Mar 1, 2012

See : http://code.google.com/apis/chart/interactive/docs/gallery/geochart.html#Configuration_Options

"An object with members to configure various aspects of the legend, or 'none', if no legend should appear."

So basically, when you're passing your configuration options into the API, you want to include the following:

legend: 'none'

A simple example set of chart options would be:

var options = {
    displayMode: 'markers',
    colorAxis: {colors: ['green', 'blue']},
    legend: 'none',
}

The modified version of the marker example provided by google on: http://code.google.com/apis/chart/interactive/docs/gallery/geochart.html#Examples