GeoChart markers, use Latitude and Longitude but want tooltip to show my text

3,189 views
Skip to first unread message

gregg

unread,
Feb 2, 2012, 9:45:24 AM2/2/12
to Google Visualization API
Hello-

I've been trying to figure this out and I'm guessing there's not a
way, but hoping there is.

Since my GeoChart (displayMode: markers) is going to consist of a lot
of data points and I can generate the Lat / Long values it makes
populating the map very quick. The problem is that the tooltip
displays the lat/long and who cares about that? It's not even
formatted in a decent way. Ideally I'd like to have it display City/
State, City/Country or whatever I provide.

I've tried a few things, and was hopeful for something like
[{v:41.8776,f:'City, ST'}, -87.6272, 169],
but didn't change anything.

Thanks!


google.load('visualization', '1', {'packages': ['geochart']});
google.setOnLoadCallback(drawVisualization);

function drawVisualization() {

var data = new google.visualization.DataTable();

data.addColumn('number', 'Latitude');
data.addColumn('number', 'Longitude');
data.addColumn('number', 'Mystery Shoppers);

data.addRows([
[41.8776, -87.6272, 169],
[39.97919999999999, 116.29919999999998, 3],
[56.0, 10.0, 440],
[62.0, 15.0, 1],
[39.9289, 116.38830000000002, 86],
[30.66669999999999, 104.06670000000003, 1],
[35.685, 139.7514, 409],
[29.75229999999999, -95.367, 9],
[55.75219999999999, 37.6156, 2],
[39.1422, 117.17669999999998, 41],
[33.61189999999999, -111.8906, 8],
[36.14429999999999, -115.183, 5],
[35.0, 105.0, 1],
[40.40299999999999, -75.5975, 2],
[42.83330000000001, 12.833300000000008, 1],
[3.1666999999999916, 101.69999999999999, 2],
[51.0, 9.0, 10],
[37.899699999999996, 112.18720000000002, 15],
[34.668499999999995, -86.5576, 1],
[57.0, 25.0, 10],
[27.78139999999999, 120.62830000000002, 6],
[38.0, -97.0, 7],
[37.0, 127.5, 49]
// data truncated for posting
]);

var options = {
displayMode: 'markers',
height: 700,
colorAxis: {colors: ['green', 'blue']}
};

visualization = document.createElement('div');

document.body.appendChild( visualization );
var geochart = new google.visualization.GeoChart(visualization);
geochart.draw(data, options );
}

EZChart

unread,
Feb 5, 2012, 1:07:14 AM2/5/12
to google-visua...@googlegroups.com
There is an undocumented support for such a column. All you have to do is place a description column before the value column, and you will see the description in the tooltip when hovering over a marker (example: http://savedbythegoog.appspot.com/?id=22d60bcbfa4ebc0f79cdc697daa208b15e4e07ba).

Important note: this feature is undocumented, and we may stop supporting it at any time without notice.


--
You received this message because you are subscribed to the Google Groups "Google Visualization API" group.
To post to this group, send email to google-visua...@googlegroups.com.
To unsubscribe from this group, send email to google-visualizati...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-visualization-api?hl=en.


gregg

unread,
Feb 6, 2012, 12:28:27 AM2/6/12
to google-visua...@googlegroups.com
Yay for undocumented features! Thank you lots. It's quite a nice feature, I hope it stays in some capacity.
-gregg
Reply all
Reply to author
Forward
0 new messages