GEO Map Labels

395 views
Skip to first unread message

UI

unread,
Oct 5, 2012, 4:23:15 AM10/5/12
to google-c...@googlegroups.com
Can I rename a GEO-CODE manually.  I do not want the label to be a number. In this case I am mapping regions in China and only the codes function.  Goal is to rename the code to the actual province name.

Thanks

_______________
<head>
  <meta http-equiv="content-type" content="text/html; charset=utf-8" />
  <title>Google Visualization API Sample</title>
  <script type="text/javascript" src="http://www.google.com/jsapi"></script>
  <script type="text/javascript">
    google.load('visualization', '1', {packages: ['geochart']});

    function drawVisualization() {
      var data = google.visualization.arrayToDataTable([
        ['Provinces', 'Popularity'],
        ['CN-11', 600],
        ['CN-50', 595],
        ['CN-31', 700],
        ['CN-53', 500]
      ]);
    
      var geochart = new google.visualization.GeoChart(
          document.getElementById('visualization'));
      geochart.draw(data, {width: 556, height: 347, region:"CN", resolution:"provinces"});
    }

    google.setOnLoadCallback(drawVisualization);
  </script>
</head>

Daniel LaLiberte

unread,
Oct 6, 2012, 9:24:34 PM10/6/12
to google-c...@googlegroups.com
You can specify the "formatted" value for each province, as you can
see in this example: http://jsfiddle.net/dlaliberte/SSCLx/6/

To do so, you have to create your datatable using the addColumn() and
addRows() mechanism, like this:

var data = new google.visualization.DataTable();
data.addColumn('string', 'Province');
data.addColumn('number', 'Popularity');

data.addRows([
[{v:"CN-11", f:"province 11"}, 600],
[{v:"CN-50", f:"province 50"}, 595],
[{v:"CN-31", f:"province 31"}, 700],
[{v:"CN-53", f:"province 53"}, 500]
]);
> --
> You received this message because you are subscribed to the Google Groups
> "Google Chart API" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/google-chart-api/-/qNr3iQY87soJ.
> To post to this group, send email to google-c...@googlegroups.com.
> To unsubscribe from this group, send email to
> google-chart-a...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/google-chart-api?hl=en.



--
Daniel LaLiberte - 978-394-1058
dlali...@Google.com 562D 5CC, Cambridge MA
daniel.l...@GMail.com 9 Juniper Ridge Road, Acton MA

UI

unread,
Oct 6, 2012, 11:29:32 PM10/6/12
to google-c...@googlegroups.com
Many thanks.  My next challenge will be to add a timeline (1990-2011).  Also currently I am inputting manually which takes time for large data sets.  Hope to find a quick solution to import data from an excel sheet.

Daniel LaLiberte

unread,
Oct 9, 2012, 10:26:01 AM10/9/12
to google-c...@googlegroups.com
Regarding the idea of adding a timeline to your geochart, you might
get some ideas from this page:
http://www.chrisdblumberg.com/unemployment/animated.html
They are using geocharts, and the "Update Values" button starts
updating values automatically like a Play button of a timeline.

dan

On Tue, Oct 9, 2012 at 10:10 AM, Sergey Grabkovsky <gra...@google.com> wrote:
> Hi UI,
>
> There is a very easy way to import data from an excel sheet. The solution is
> to use Google Docs to import your spreadsheet and then to get data from it
> using a query. You may have to share the spreadsheet in order for other
> people to see it.
>
> - Sergey
> https://groups.google.com/d/msg/google-chart-api/-/fbvespXvf0gJ.

UI

unread,
Oct 30, 2012, 10:43:19 AM10/30/12
to google-c...@googlegroups.com
http://jsfiddle.net/asgallant/86ZA3/1/ works very well for what I want to do.  I still have problems with entering the data using google spreadsheets.
Reply all
Reply to author
Forward
0 new messages