Google Charts:仅显示某个国家/地区

发布于 2024-12-21 05:18:46 字数 252 浏览 5 评论 0原文

我正在为新客户的帐户深入研究 Google Charts,并且想知道是否可以使用 Map API 仅显示某个国家/地区。 我已经设法设置了选定的区域,但我似乎找不到排除邻国的方法。 将不胜感激有关此主题的任何帮助或指导。

我所指的示例 - http://raphaeljs.com/australia.html (Don'但是不想使用这个库。)

I'm digging into Google Charts on the account of a new client, and was wondering if it's possible to show only a certain country using the Map API.
I've managed to set up selected regions but I can't seem to find a way to exclude neighboring countries.
Would appreciate any help or direction on this subject.

Example of what I'm referring to - http://raphaeljs.com/australia.html (Don't want to use this library however.)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

顾铮苏瑾 2024-12-28 05:18:46

使用 Google Charts API 可以仅显示某个国家/地区。
方法是在选项变量中设置区域,并在绘制地图时使用选项变量。

var options = {};
options['region'] = 'AU';
...
geomap.draw(data, options);

查看 API 文档中提供的示例:http:// /code.google.com/apis/chart/interactive/docs/gallery/geomap.html#markersexample

It is possible to display only a certain country using the Google Charts API.
The way to do it is to set the region in the options variable and use the options variable when you draw the map.

var options = {};
options['region'] = 'AU';
...
geomap.draw(data, options);

Check out the example provided in the API documentation: http://code.google.com/apis/chart/interactive/docs/gallery/geomap.html#markersexample

慵挽 2024-12-28 05:18:46

我已经在我的网络应用程序中尝试了谷歌图表代码。但这对我不起作用。
Peckage ['Map'] 正在运行
使用 ['Geomap'] 包我的页面上没有显示任何内容。
并使用包 ['map'] ,我只显示 1 个国家/地区图表。有什么我想念的吗?

<script type='text/javascript'>
            google.charts.load('current', {'packages': ['geomap']});
            google.charts.setOnLoadCallback(drawMap);
            function drawMap()
                    var data = google.visualization.arrayToDataTable([
                            ['City', 'Popularity'],
                            ['New York', 200],
                            ['Boston', 300],
                            ['Miami', 400],
                            ['Chicago', 500],
                            ['Los Angeles', 600],
                            ['Houston', 700]
                    ]);
                    var options = {};
            options['region'] = 'US';
            options['colors'] = [0xFF8747, 0xFFB581, 0xc06000]; //orange colors
            options['dataMode'] = 'markers';
            var container = document.getElementById('map_canvas');
            var geomap = new google.visualization.GeoMap(container);
            geomap.draw(data, options);
    };
</script>    
<div id="map_canvas" style="width: 900px; height: 500px;"></div> 

I have tried the google chart code with my web application. but this is not working for me.
Peckage ['Map'] is working
Using ['Geomap'] package nothing is showing on my page.
and using package ['map'] , i cat display only 1 country chart. Is there anything which i am missing.

<script type='text/javascript'>
            google.charts.load('current', {'packages': ['geomap']});
            google.charts.setOnLoadCallback(drawMap);
            function drawMap()
                    var data = google.visualization.arrayToDataTable([
                            ['City', 'Popularity'],
                            ['New York', 200],
                            ['Boston', 300],
                            ['Miami', 400],
                            ['Chicago', 500],
                            ['Los Angeles', 600],
                            ['Houston', 700]
                    ]);
                    var options = {};
            options['region'] = 'US';
            options['colors'] = [0xFF8747, 0xFFB581, 0xc06000]; //orange colors
            options['dataMode'] = 'markers';
            var container = document.getElementById('map_canvas');
            var geomap = new google.visualization.GeoMap(container);
            geomap.draw(data, options);
    };
</script>    
<div id="map_canvas" style="width: 900px; height: 500px;"></div> 
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文