Google IntensityMap Visualization US States

ぃ、小莉子 提交于 2019-12-06 09:19:15

问题


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?


回答1:


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.




回答2:


It looks like Google isn't sharing that capability right now. It's a few months old, but this reply on the Google Chart API group seems to kill the idea. I'm looking for the same functionality, but the closest I've found is Maps Alive (no affiliation). However, their API seems more limited and the pricing adds up quickly. Best of luck!



来源:https://stackoverflow.com/questions/5547499/google-intensitymap-visualization-us-states

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!