Google Geochart: custom display name using lat / long markers and both

I have a Google Geochart with the following columns:

// Lat, Long, Value 1, Value 2 [-22.764042, -43.39921 , 2.86, 1], [-22.755635, -43.460325 , 3.70, 2], [-22.912897, -43.200295 , 0.50, 1], [-22.805776 , -43.37292 , 6.67, 2], [-23.532905 , -46.63952 , 33.33, 5] // ...many rows 

I checked the other answers, but they do not work here.

I cannot use these columns of values to display a label, because both values โ€‹โ€‹are important in this diagram.

I cannot use addresses instead of lat / long, because it is actually very slow to load all tokens (and there are a lot of them in the real diagram).

I decided to apply formatters , but it seems that they are overridden by a library that displays a โ€œbeautifulโ€ coordinate (instead of 22ยบ76'4042 "S, 43ยบ39'921" W from -22.764042, -43.39921)

Is there any way to load chart markers with coordinates, but display a custom label on my tooltips ?

+7
google-visualization
source share
1 answer

You can add a row column after the lat / long columns to give the data label a label for tooltips:

 var data = new google.visualization.DataTable(); data.addColumn('number', 'Latitude'); data.addColumn('number', 'Longitude'); data.addColumn('string', 'Label'); data.addColumn('number', 'Value 1'); data.addColumn('number', 'Value 2'); data.addRows([ [-22.764042, -43.39921, 'Foo', 2.86, 1], [-22.755635, -43.460325, 'Bar', 3.70, 2], [-22.912897, -43.200295, 'Baz', 0.50, 1], [-22.805776, -43.37292, 'Cad', 6.67, 2], [-23.532905, -46.63952, 'Qud', 33.33, 5] ]); 

See an example here: http://jsfiddle.net/asgallant/GKmm5/

+9
source share

All Articles