google geochart cities

2,669 views
Skip to first unread message

Vadim

unread,
Dec 21, 2016, 12:21:29 PM12/21/16
to Google Visualization API
One or two weeks lost some russian cities, f.e. Moscow.
This script show 'Arkhangelsk' city, but no 'Moscow'.
Any ideas?

Vadim





<script type='text/javascript' src='https://www.google.com/jsapi'></script>
<script type='text/javascript'>
google.load('visualization', '1', {packages: ['geochart']});
google.setOnLoadCallback(drawVisualization);

function drawVisualization() {
 var data = google.visualization.arrayToDataTable([
      ['City', 'rub/kg', '$/тн'],
      ['Moscow', 35.60, 576.08],
      ['Arkhangelsk', 38.00, 614.92]
      ]);

    var geochart = new google.visualization.GeoChart(document.getElementById('visualization'));

    var options = {
                region: 'RU',
                displayMode: 'markers',
                resolution: 'provinces',
                colorAxis: { colors: ['red', 'green'] }
            };
    geochart.draw(data, options);
}

    </script>

<div id="visualization"></div>

Daniel LaLiberte

unread,
Dec 21, 2016, 1:04:28 PM12/21/16
to Google Visualization API
If you add ', RU' to the city names, it works better, at least for Russian cities. Here is what I tried just now:  https://jsfiddle.net/dlaliberte/ugeqvz2t/
Note that Kirov is not found where I thought it would be, and Omsk and Kazan are not found at all.

--
You received this message because you are subscribed to the Google Groups "Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-visualization-api+unsub...@googlegroups.com.
To post to this group, send email to google-visualization-api@googlegroups.com.
Visit this group at https://groups.google.com/group/google-visualization-api.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-visualization-api/5e8f763b-3ba2-420d-bd8c-0ab821b1eea4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Message has been deleted

Vadim

unread,
Dec 21, 2016, 2:22:13 PM12/21/16
to Google Visualization API
Thanks. 

"Moscow, RU" is correct, but "Belgorod, RU" is not, just "Belgorod". "Vladivostok, Primorskij kraj" is good, but not "Vladivostok, RU". Some kind of Chinese puzzle

Vadim


Daniel LaLiberte

unread,
Dec 21, 2016, 2:37:33 PM12/21/16
to Google Visualization API
Curious.  This is the Google Maps Geocoding service being used by Google Charts, so they would need to answer for what is going on.  https://developers.google.com/maps/documentation/geocoding/intro

--
You received this message because you are subscribed to the Google Groups "Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-visualization-api+unsub...@googlegroups.com.
To post to this group, send email to google-visualization-api@googlegroups.com.
Visit this group at https://groups.google.com/group/google-visualization-api.

For more options, visit https://groups.google.com/d/optout.

Vadim

unread,
Dec 21, 2016, 6:33:58 PM12/21/16
to Google Visualization API
I maked it with Latitude and Longitude

<script type='text/javascript' src='https://www.google.com/jsapi'></script>
<script type='text/javascript'>

function drawChart() {
    var data = new google.visualization.DataTable();
    data.addColumn('number', 'Latitude');
    data.addColumn('number', 'Longitude');
    data.addColumn('string', 'City');
    data.addColumn('number', 'Цена, руб./кг');

        data.addRows([
      [64.551111, 40.533333, 'Архангельск', 38.00],
      [53.347361, 83.778333, 'Барнаул', 37.50],
      [50.6, 36.6, 'Белгород', 33.20],
      [53.25, 34.366667, 'Брянск', 34.50],
      [58.525, 31.275, 'Великий Новгород', 36.00],
      [43.116667, 131.9, 'Владивосток', 41.50],
      [51.671667, 39.210556, 'Воронеж', 33.60],
      [56.833333, 60.583333, 'Екатеринбург', 37.00],
      [56.85, 53.216667, 'Ижевск', 37.50],
      [52.283333, 104.3, 'Иркутск', 41.00],
      [56.632778, 47.895833, 'Йошкар-Ола', 35.60],
      [55.354167, 86.089722, 'Кемерово', 39.00],
      [58.6, 49.65, 'Киров', 36.50],
      [45.033333, 38.983333, 'Краснодар', 33.60],
      [56.012083, 92.871295, 'Красноярск', 39.00],
      [51.716667, 36.183333, 'Курск', 33.20],
      [52.616667, 39.6, 'Липецк', 34.00],
      [55.755833, 37.617778, 'Москва', 35.35],
      [68.966667, 33.083333, 'Мурманск', 39.00],
      [56.326944, 44.0075, 'Нижний Новгород', 36.00],
      [53.733333, 87.083333, 'Новокузнецк', 39.00],
      [55.016667, 82.916667, 'Новосибирск', 39.00],
      [54.966667, 73.383333, 'Омск', 38.00],
      [52.966667, 36.083333, 'Орёл', 33.30],
      [61.796111, 34.349167, 'Петрозаводск', 37.00],
      [47.240556, 39.710556, 'Ростов-на-Дону', 33.60],
      [53.183333, 50.116667, 'Самара', 36.50],
      [59.950001, 30.316667, 'Санкт-Петербург', 36.00],
      [51.533333, 46.016667, 'Саратов', 34.90],
      [52.716667, 41.433333, 'Тамбов', 33.30],
      [54.733333, 55.966667, 'Уфа', 36.00],
      [48.483333, 135.066667, 'Хабаровск', 41.50],
      [55.162222, 61.403056, 'Челябинск', 36.50],
 ]);
    var chart = new google.visualization.GeoChart(document.querySelector('#chart_div'));
    chart.draw(data, {
        width: 935,
        region: 'RU',
        backgroundColor: '#81d4fa',
        colorAxis: {colors: ['green', 'red']}
    });
}
google.load('visualization', '1', {packages:['geochart'], callback: drawChart});
</script>

    <div id='chart_div'></div>

Reply all
Reply to author
Forward
0 new messages