I am working on this code at the moment, it all works well but when I hover a country with my mouse I only want the country name to appear in the label, not the related value. Can I do that? If so, how?
Thanks in advance!
Here’s the javascript code:
google.load('visualization', '1', {'packages': ['geochart']});
google.setOnLoadCallback(drawRegionsMap);
function drawRegionsMap() {
var data = google.visualization.arrayToDataTable([
['Country', 'Value'],
['Albania', 1],
['Algeria', 1],
]);
var options = {
colorAxis: {colors:['#386a90']}, legend:'none', datalessRegionColor:'#f1f1f1'
};
var chart = new google.visualization.GeoChart(document.getElementById('chart_div'));
chart.draw(data, options);
};
</script>
There is no built-in way to do that.
You can avoid the tooltip altogether with this option:
Otherwise, but this is not supported by the API, you could probably manage to avoid the display of the strings “Value”, “:” and “1” by looking for – with jQuery.contains() for example – all the tags of type “text” that contain the strings “Value”, “:” or “1” and hide them. This is not going to look very nice because the tooltip square is going to stay large, but this may do the trick.