I'm using the Google Visualization Geochart API to create a map of a country's regions. I provide the ISO 3266-2 Country subdivision code and get the correct results. However showing the ISO 3266-2 codes as label in the chart is a bad user experience. So I would like to provide a custom label. Take this as an example:
function drawVisualization() {
var data = google.visualization.arrayToDataTable([
['Country', 'Popularity'],
['DE-BY', 200],
['DE-NW', 500]
]);
var geochart = new google.visualization.GeoChart(
document.getElementById('visualization'));
geochart.draw(data, {width: 556, height: 347, region: 'DE', resolution: 'provinces'});
}
[Try it on the Code Playground]
I would like to provide 'DE-BY' but have 'Bavaria' as label. It is necessary for me to use the ISO 3266-2 codes as although Google writes that an
English text equivalent (for example, "US-NJ" or "New Jersey")
is allowed, it is very unreliable and doesn't work with the example 'Bavaria'.