Google IntensityMap可视化美国 [英] Google IntensityMap Visualization US States

查看:153
本文介绍了Google IntensityMap可视化美国的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图使用google可视化库 - 强度图。我有一个州的列表和每个州的用户数量。我只能获取世界地图来显示,我想突出显示美国各州并仅向我们显示地图。

I am attempting to use the google visualization library - intensity map. I have a list of states and the number of users in each state. I can only get the world map to show, I want to highlight the us states and only show us map.

http://code.google.com/apis/visualization/documentation/gallery/geomap.html

有没有人有一个很好的例子,教程或说明如何做到这一点?

Does anyone have a good example, tutorial or instructions on how to do this?

推荐答案

<这原来很简单。只需要弄清楚地区名称'美国'。

This turned out to be very easy. Just need to figure out the region name 'usa'.

function drawVisualization() {

    var options = {};
    options['region'] = 'usa';
    options['dataMode'] = 'regions';

    var data = new google.visualization.DataTable();
    data.addColumn('string', '', 'USA');
    data.addColumn('number', 'Particpants', 'a');
    data.addRows(1);
    data.setValue(0, 0, CA);
    data.setValue(0, 1, 44);

    // Create and draw the visualization.
    new google.visualization.IntensityMap(document.getElementById('visualization')).
    draw(data, options);
}

google.setOnLoadCallback(drawVisualization);

希望这可以帮到你,让我知道它是否适合你。这不是完整的代码片段,但应该足以实现这个想法。让我知道你是否需要更多细节。

Hope this helps, let me know if it works for you. This is not the full code snippet but should be enough to get the idea. Let me know if you need more specifics.

这篇关于Google IntensityMap可视化美国的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆