开发者

Google IntensityMap Visualization US States

开发者 https://www.devze.com 2023-02-22 16:07 出处:网络
I am attempting to use the google visualization l开发者_如何转开发ibrary - 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 h

I am attempting to use the google visualization l开发者_如何转开发ibrary - 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.


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!

0

精彩评论

暂无评论...
验证码 换一张
取 消