• forked:Visualization Map Generator For Statistical Data
Import an externally hosted application
Check style

  • JavaScript
  • CSS
  • HTML
  • Images
  • Input Data
  • ReadMe
  • forked:Visualization Map Generator For Statistical Data
  • jquery-1.7.1.min.js  
  • http://www.google.com/jsapi  
  • http://canvg.googlecode.com/svn/trunk/rgbcolor.js  
  • http://canvg.googlecode.com/svn/trunk/canvg.js  
  •  
  • history

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
 
var drawMarkersMap = function(rawData) {
    if(! rawData) {
        rawData =[];
    }
    var data = google.visualization.arrayToDataTable(rawData);
 
    var options = {backgroundColor : '#0B173B', minValue: 0,  colors: ['#F2F5A9', '#04B431']};
    var chart = new google.visualization.GeoChart(document.getElementById('paintedMap'));
    chart.draw(data, options);
}
    
    google.load('visualization', '1', {packages: ['geochart']});
    google.setOnLoadCallback(drawMarkersMap);
 
window.onload = function() {
    GenerateHeatmap.initFileList();
};
 
GenerateHeatmap = {};
GenerateHeatmap.fileName = "";
 
GenerateHeatmap.initFileList = function(){
    var sb =[];
    $.each(LinkData.getWorks(), function(workKey, workValue) {
        $.each(LinkData.getFiles(workValue), function(fileKey, fileValue) {
            sb[sb.length] = "<option value=\"" + fileValue + "\">"+ fileValue +"</option>";
        });
    });
    
    $("#fileOptions").append(sb.join(""));
    $("#fileOptions").change(GenerateHeatmap.drawMap);  
    $("#generate").click(generatePng);
    $("#generate").click(function(){
        $(".downloadButton").css("display", "");
    });
}
GenerateHeatmap.drawMap = function(event){
    var fileValue = event.currentTarget.value;
    if(fileValue == ""){
        return ;
    }
    GenerateHeatmap.fileName = fileValue;
    var data = [];
    data[data.length] = ["Country", fileValue];
    
    var workId = "rdf1s794i";
    
    $.each(LinkData.getSubjects( workId, fileValue), function(subjKey, subjValue) {
        var countryCode ="";
        var measured =0;
        
        var propAry = LinkData.getProperties(workId, fileValue);
        for(var i = 0 ; i < propAry.length ; i++){
            var propValue = propAry[i]
            if(propValue == "http://www.geonames.org/ontology#countryCode"){
                countryCode = LinkData.getObjects(workId, fileValue, subjValue, propValue)[0];
            }
            if(propValue == "http://linkdata.org/property/"+workId+"#value"){
                measured = LinkData.getObjects(workId, fileValue, subjValue, propValue)[0];
            }
        }
        data[data.length] = [countryCode, parseInt(measured, 10)];
//      $("#debug").append(countryCode + " <-> "+measured + "<br>");
    });
    drawMarkersMap(data);
}
 
    function generatePng(){
        var svg = $("#paintedMap").children().children();
        canvg('canvas', svg.html(), { ignoreMouse: true, ignoreAnimation: true } );
        var c = document.getElementById('canvas');
 
        var type = 'image/png'; 
        var data = c.toDataURL(type);
 
        $('#png').attr('download', GenerateHeatmap.fileName + ".png");
        $('#png').attr('href', data);
    }
 
jquery-1.7.1.min.js
http://www.google.com/jsapi
http://canvg.googlecode.com/svn/trunk/rgbcolor.js
http://canvg.googlecode.com/svn/trunk/canvg.js
Playing...

jquery-1.7.1.min.js
http://www.google.com/jsapi
http://canvg.googlecode.com/svn/trunk/rgbcolor.js
http://canvg.googlecode.com/svn/trunk/canvg.js