├── corona.cases.csv ├── corona_status.csv ├── corona_status.json ├── exportdata.rb ├── corona_status.color.json ├── index.html └── datamaps.ind.min.js /corona.cases.csv: -------------------------------------------------------------------------------- 1 | 1 Andhra Pradesh 7 0 0 0 2 | 2 Bihar 2 0 0 1 3 | 3 Chhattisgarh 1 0 0 0 4 | 4 Delhi 30 1 6 1 5 | 5 Gujarat 29 0 0 1 6 | 6 Haryana 12 14 11 0 7 | 7 Himachal Pradesh 3 0 0 1 8 | 8 Karnataka 37 0 2 1 9 | 9 Kerala 87 8 4 0 10 | 10 Madhya Pradesh 7 0 0 0 11 | 11 Maharashtra 84 3 0 2 12 | 12 Odisha 2 0 0 0 13 | 13 Puducherry 1 0 0 0 14 | 14 Punjab 21 0 0 1 15 | 15 Rajasthan 31 2 3 0 16 | 16 Tamil Nadu 10 2 1 0 17 | 17 Telengana 22 10 1 0 18 | 18 Chandigarh 6 0 0 0 19 | 19 Jammu and Kashmir 4 0 0 0 20 | 20 Ladakh 13 0 0 0 21 | 21 Uttar Pradesh 32 1 9 0 22 | 22 Uttarakhand 3 0 0 0 23 | 23 West Bengal 7 0 0 1 -------------------------------------------------------------------------------- /corona_status.csv: -------------------------------------------------------------------------------- 1 | AP,7,9.86,0,0.0,0,0.0,0,0.0 2 | BR,2,2.82,0,0.0,0,0.0,1,50.0 3 | CT,1,1.41,0,0.0,0,0.0,0,0.0 4 | DL,28,39.44,1,7.14,5,45.45,1,50.0 5 | GJ,29,40.85,0,0.0,0,0.0,1,50.0 6 | HR,12,16.9,14,100.0,11,100.0,0,0.0 7 | HP,3,4.23,0,0.0,0,0.0,1,50.0 8 | KA,33,46.48,0,0.0,2,18.18,1,50.0 9 | KL,60,84.51,7,50.0,3,27.27,0,0.0 10 | MP,6,8.45,0,0.0,0,0.0,0,0.0 11 | MH,71,100.0,3,21.43,0,0.0,2,100.0 12 | OD,2,2.82,0,0.0,0,0.0,0,0.0 13 | PY,1,1.41,0,0.0,0,0.0,0,0.0 14 | PB,21,29.58,0,0.0,0,0.0,1,50.0 15 | RJ,26,36.62,2,14.29,3,27.27,0,0.0 16 | TN,7,9.86,2,14.29,1,9.09,0,0.0 17 | TS,22,30.99,10,71.43,1,9.09,0,0.0 18 | CH,6,8.45,0,0.0,0,0.0,0,0.0 19 | JK,4,5.63,0,0.0,0,0.0,0,0.0 20 | LK,13,18.31,0,0.0,0,0.0,0,0.0 21 | UP,30,42.25,1,7.14,9,81.82,0,0.0 22 | UK,3,4.23,0,0.0,0,0.0,0,0.0 23 | WB,7,9.86,0,0.0,0,0.0,1,50.0 24 | -------------------------------------------------------------------------------- /corona_status.json: -------------------------------------------------------------------------------- 1 | [{"centered":"AP","radius":3.0,"state":"Andhra Pradesh","info":[7,8.05,0,0.0,0,0.0,0,0.0]},{"centered":"BR","radius":1.0,"state":"Bihar","info":[2,2.3,0,0.0,0,0.0,1,50.0]},{"centered":"CT","radius":1.0,"state":"Chhattisgarh","info":[1,1.15,0,0.0,0,0.0,0,0.0]},{"centered":"DL","radius":11.0,"state":"Delhi","info":[30,34.48,1,7.14,6,54.55,1,50.0]},{"centered":"GJ","radius":11.0,"state":"Gujarat","info":[29,33.33,0,0.0,0,0.0,1,50.0]},{"centered":"HR","radius":5.0,"state":"Haryana","info":[12,13.79,14,100.0,11,100.0,0,0.0]},{"centered":"HP","radius":2.0,"state":"Himachal Pradesh","info":[3,3.45,0,0.0,0,0.0,1,50.0]},{"centered":"KA","radius":13.0,"state":"Karnataka","info":[37,42.53,0,0.0,2,18.18,1,50.0]},{"centered":"KL","radius":31.0,"state":"Kerala","info":[87,100.0,8,57.14,4,36.36,0,0.0]},{"centered":"MP","radius":3.0,"state":"Madhya Pradesh","info":[7,8.05,0,0.0,0,0.0,0,0.0]},{"centered":"MH","radius":29.0,"state":"Maharashtra","info":[84,96.55,3,21.43,0,0.0,2,100.0]},{"centered":"OD","radius":1.0,"state":"Odisha","info":[2,2.3,0,0.0,0,0.0,0,0.0]},{"centered":"PY","radius":1.0,"state":"Puducherry","info":[1,1.15,0,0.0,0,0.0,0,0.0]},{"centered":"PB","radius":8.0,"state":"Punjab","info":[21,24.14,0,0.0,0,0.0,1,50.0]},{"centered":"RJ","radius":11.0,"state":"Rajasthan","info":[31,35.63,2,14.29,3,27.27,0,0.0]},{"centered":"TN","radius":4.0,"state":"Tamil Nadu","info":[10,11.49,2,14.29,1,9.09,0,0.0]},{"centered":"TS","radius":8.0,"state":"Telengana","info":[22,25.29,10,71.43,1,9.09,0,0.0]},{"centered":"CH","radius":3.0,"state":"Chandigarh","info":[6,6.9,0,0.0,0,0.0,0,0.0]},{"centered":"JK","radius":2.0,"state":"Jammu and Kashmir","info":[4,4.6,0,0.0,0,0.0,0,0.0]},{"centered":"LK","radius":5.0,"state":"Ladakh","info":[13,14.94,0,0.0,0,0.0,0,0.0]},{"centered":"UP","radius":12.0,"state":"Uttar Pradesh","info":[32,36.78,1,7.14,9,81.82,0,0.0]},{"centered":"UK","radius":2.0,"state":"Uttarakhand","info":[3,3.45,0,0.0,0,0.0,0,0.0]},{"centered":"WB","radius":3.0,"state":"West Bengal","info":[7,8.05,0,0.0,0,0.0,1,50.0]}] 2 | -------------------------------------------------------------------------------- /exportdata.rb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: false 3 | 4 | require 'csv' 5 | require 'json' 6 | 7 | require 'chroma' 8 | 9 | INDIAN_STATES = { 10 | AN: 'Andaman & Nicobar Island', 11 | AP: 'Andhra Pradesh', 12 | AR: 'Arunanchal Pradesh', 13 | AS: 'Assam', 14 | BR: 'Bihar', 15 | CH: 'Chandigarh', 16 | CT: 'Chhattisgarh', 17 | DD: 'Daman & Diu', 18 | DL: 'Delhi', 19 | DN: 'Dadara & Nagar Havelli', 20 | GA: 'Goa', 21 | GJ: 'Gujarat', 22 | HP: 'Himachal Pradesh', 23 | HR: 'Haryana', 24 | JH: 'Jharkhand', 25 | JK: 'Jammu and Kashmir', 26 | KA: 'Karnataka', 27 | KL: 'Kerala', 28 | LD: 'Lakshadweep', 29 | MH: 'Maharashtra', 30 | ML: 'Meghalaya', 31 | MN: 'Manipur', 32 | MP: 'Madhya Pradesh', 33 | MZ: 'Mizoram', 34 | NL: 'Nagaland', 35 | OD: 'Odisha', 36 | PB: 'Punjab', 37 | PY: 'Puducherry', 38 | RJ: 'Rajasthan', 39 | SK: 'Sikkim', 40 | TN: 'Tamil Nadu', 41 | TR: 'Tripura', 42 | TS: 'Telengana', 43 | UK: 'Uttarakhand', 44 | UP: 'Uttar Pradesh', 45 | WB: 'West Bengal', 46 | LK: 'Ladakh' 47 | } 48 | 49 | def heatmap_color_for(value, type) 50 | n = (255.0 * value).floor 51 | if type == 'death' 52 | r = 255 - n 53 | g = 255 - n 54 | b = 255 - n 55 | elsif type == 'cured' 56 | r = 255 - n 57 | g = 255 58 | b = 255 - n 59 | else 60 | r = 255 61 | g = 255 - n 62 | b = 255 - n 63 | end 64 | 65 | color = ['rgb(', r, ',', g, ',', b, ')'].join('') 66 | Chroma.paint(color).to_hex 67 | end 68 | 69 | data = CSV.read('corona.cases.csv', col_sep: "\t", converters: %i[numeric]) 70 | 71 | total = 0 72 | foreign = 0 73 | cured = 0 74 | death = 0 75 | data.each do |e| 76 | total = e[2] if total < e[2] 77 | foreign = e[3] if foreign < e[3] 78 | cured = e[4] if cured < e[4] 79 | death = e[5] if death < e[5] 80 | end 81 | 82 | json = [] 83 | colormap = { 84 | 'total' => { "fills": { defaultFill: 'white' }, "states": {} }, 85 | 'cured' => { "fills": { defaultFill: 'white' }, "states": {} }, 86 | 'death' => { "fills": { defaultFill: 'white' }, "states": {} } 87 | } 88 | 89 | MAX = { 'total' => total, 'cured' => cured, 'death' => death } 90 | 91 | data.each do |e| 92 | [['total', 2], ['cured', 4], ['death', 5]].each do |type| 93 | color = heatmap_color_for(1.0 * e[type.last] / MAX[type.first], type.first) 94 | colormap[type.first][:states][INDIAN_STATES.key(e[1])] = { 95 | fillKey: color, 96 | info: [ 97 | e[2], 98 | (100.0 * e[2] / total).round(2), 99 | e[3], 100 | (100.0 * e[3] / foreign).round(2), 101 | e[4], 102 | (100.0 * e[4] / cured).round(2), 103 | e[5], 104 | (100.0 * e[5] / death.round(2)) 105 | ] 106 | } 107 | colormap[type.first][:fills][color] = color 108 | end 109 | 110 | json << 111 | { 112 | centered: INDIAN_STATES.key(e[1]), 113 | radius: 1.0 + (30 * e[2] / total).round(2), 114 | state: e[1], 115 | info: [ 116 | e[2], 117 | (100.0 * e[2] / total).round(2), 118 | e[3], 119 | (100.0 * e[3] / foreign).round(2), 120 | e[4], 121 | (100.0 * e[4] / cured).round(2), 122 | e[5], 123 | (100.0 * e[5] / death.round(2)) 124 | ] 125 | } 126 | end 127 | 128 | out = File.open('corona_status.json', 'w') 129 | out.puts JSON.generate(json) 130 | out.close 131 | 132 | out = File.open('corona_status.color.json', 'w') 133 | out.puts JSON.generate(colormap) 134 | out.close 135 | -------------------------------------------------------------------------------- /corona_status.color.json: -------------------------------------------------------------------------------- 1 | {"total":{"fills":{"defaultFill":"white","#ffebeb":"#ffebeb","#fffafa":"#fffafa","#fffdfd":"#fffdfd","#ffa8a8":"#ffa8a8","#ffaaaa":"#ffaaaa","#ffdcdc":"#ffdcdc","#fff7f7":"#fff7f7","#ff9393":"#ff9393","#ff0000":"#ff0000","#ff0909":"#ff0909","#ffc2c2":"#ffc2c2","#ffa5a5":"#ffa5a5","#ffe2e2":"#ffe2e2","#ffbfbf":"#ffbfbf","#ffeeee":"#ffeeee","#fff4f4":"#fff4f4","#ffd9d9":"#ffd9d9","#ffa2a2":"#ffa2a2"},"states":{"AP":{"fillKey":"#ffebeb","info":[7,8.05,0,0.0,0,0.0,0,0.0]},"BR":{"fillKey":"#fffafa","info":[2,2.3,0,0.0,0,0.0,1,50.0]},"CT":{"fillKey":"#fffdfd","info":[1,1.15,0,0.0,0,0.0,0,0.0]},"DL":{"fillKey":"#ffa8a8","info":[30,34.48,1,7.14,6,54.55,1,50.0]},"GJ":{"fillKey":"#ffaaaa","info":[29,33.33,0,0.0,0,0.0,1,50.0]},"HR":{"fillKey":"#ffdcdc","info":[12,13.79,14,100.0,11,100.0,0,0.0]},"HP":{"fillKey":"#fff7f7","info":[3,3.45,0,0.0,0,0.0,1,50.0]},"KA":{"fillKey":"#ff9393","info":[37,42.53,0,0.0,2,18.18,1,50.0]},"KL":{"fillKey":"#ff0000","info":[87,100.0,8,57.14,4,36.36,0,0.0]},"MP":{"fillKey":"#ffebeb","info":[7,8.05,0,0.0,0,0.0,0,0.0]},"MH":{"fillKey":"#ff0909","info":[84,96.55,3,21.43,0,0.0,2,100.0]},"OD":{"fillKey":"#fffafa","info":[2,2.3,0,0.0,0,0.0,0,0.0]},"PY":{"fillKey":"#fffdfd","info":[1,1.15,0,0.0,0,0.0,0,0.0]},"PB":{"fillKey":"#ffc2c2","info":[21,24.14,0,0.0,0,0.0,1,50.0]},"RJ":{"fillKey":"#ffa5a5","info":[31,35.63,2,14.29,3,27.27,0,0.0]},"TN":{"fillKey":"#ffe2e2","info":[10,11.49,2,14.29,1,9.09,0,0.0]},"TS":{"fillKey":"#ffbfbf","info":[22,25.29,10,71.43,1,9.09,0,0.0]},"CH":{"fillKey":"#ffeeee","info":[6,6.9,0,0.0,0,0.0,0,0.0]},"JK":{"fillKey":"#fff4f4","info":[4,4.6,0,0.0,0,0.0,0,0.0]},"LK":{"fillKey":"#ffd9d9","info":[13,14.94,0,0.0,0,0.0,0,0.0]},"UP":{"fillKey":"#ffa2a2","info":[32,36.78,1,7.14,9,81.82,0,0.0]},"UK":{"fillKey":"#fff7f7","info":[3,3.45,0,0.0,0,0.0,0,0.0]},"WB":{"fillKey":"#ffebeb","info":[7,8.05,0,0.0,0,0.0,1,50.0]}}},"cured":{"fills":{"defaultFill":"white","#ffffff":"#ffffff","#74ff74":"#74ff74","#00ff00":"#00ff00","#d1ffd1":"#d1ffd1","#a3ffa3":"#a3ffa3","#baffba":"#baffba","#e8ffe8":"#e8ffe8","#2fff2f":"#2fff2f"},"states":{"AP":{"fillKey":"#ffffff","info":[7,8.05,0,0.0,0,0.0,0,0.0]},"BR":{"fillKey":"#ffffff","info":[2,2.3,0,0.0,0,0.0,1,50.0]},"CT":{"fillKey":"#ffffff","info":[1,1.15,0,0.0,0,0.0,0,0.0]},"DL":{"fillKey":"#74ff74","info":[30,34.48,1,7.14,6,54.55,1,50.0]},"GJ":{"fillKey":"#ffffff","info":[29,33.33,0,0.0,0,0.0,1,50.0]},"HR":{"fillKey":"#00ff00","info":[12,13.79,14,100.0,11,100.0,0,0.0]},"HP":{"fillKey":"#ffffff","info":[3,3.45,0,0.0,0,0.0,1,50.0]},"KA":{"fillKey":"#d1ffd1","info":[37,42.53,0,0.0,2,18.18,1,50.0]},"KL":{"fillKey":"#a3ffa3","info":[87,100.0,8,57.14,4,36.36,0,0.0]},"MP":{"fillKey":"#ffffff","info":[7,8.05,0,0.0,0,0.0,0,0.0]},"MH":{"fillKey":"#ffffff","info":[84,96.55,3,21.43,0,0.0,2,100.0]},"OD":{"fillKey":"#ffffff","info":[2,2.3,0,0.0,0,0.0,0,0.0]},"PY":{"fillKey":"#ffffff","info":[1,1.15,0,0.0,0,0.0,0,0.0]},"PB":{"fillKey":"#ffffff","info":[21,24.14,0,0.0,0,0.0,1,50.0]},"RJ":{"fillKey":"#baffba","info":[31,35.63,2,14.29,3,27.27,0,0.0]},"TN":{"fillKey":"#e8ffe8","info":[10,11.49,2,14.29,1,9.09,0,0.0]},"TS":{"fillKey":"#e8ffe8","info":[22,25.29,10,71.43,1,9.09,0,0.0]},"CH":{"fillKey":"#ffffff","info":[6,6.9,0,0.0,0,0.0,0,0.0]},"JK":{"fillKey":"#ffffff","info":[4,4.6,0,0.0,0,0.0,0,0.0]},"LK":{"fillKey":"#ffffff","info":[13,14.94,0,0.0,0,0.0,0,0.0]},"UP":{"fillKey":"#2fff2f","info":[32,36.78,1,7.14,9,81.82,0,0.0]},"UK":{"fillKey":"#ffffff","info":[3,3.45,0,0.0,0,0.0,0,0.0]},"WB":{"fillKey":"#ffffff","info":[7,8.05,0,0.0,0,0.0,1,50.0]}}},"death":{"fills":{"defaultFill":"white","#ffffff":"#ffffff","#808080":"#808080","#000000":"#000000"},"states":{"AP":{"fillKey":"#ffffff","info":[7,8.05,0,0.0,0,0.0,0,0.0]},"BR":{"fillKey":"#808080","info":[2,2.3,0,0.0,0,0.0,1,50.0]},"CT":{"fillKey":"#ffffff","info":[1,1.15,0,0.0,0,0.0,0,0.0]},"DL":{"fillKey":"#808080","info":[30,34.48,1,7.14,6,54.55,1,50.0]},"GJ":{"fillKey":"#808080","info":[29,33.33,0,0.0,0,0.0,1,50.0]},"HR":{"fillKey":"#ffffff","info":[12,13.79,14,100.0,11,100.0,0,0.0]},"HP":{"fillKey":"#808080","info":[3,3.45,0,0.0,0,0.0,1,50.0]},"KA":{"fillKey":"#808080","info":[37,42.53,0,0.0,2,18.18,1,50.0]},"KL":{"fillKey":"#ffffff","info":[87,100.0,8,57.14,4,36.36,0,0.0]},"MP":{"fillKey":"#ffffff","info":[7,8.05,0,0.0,0,0.0,0,0.0]},"MH":{"fillKey":"#000000","info":[84,96.55,3,21.43,0,0.0,2,100.0]},"OD":{"fillKey":"#ffffff","info":[2,2.3,0,0.0,0,0.0,0,0.0]},"PY":{"fillKey":"#ffffff","info":[1,1.15,0,0.0,0,0.0,0,0.0]},"PB":{"fillKey":"#808080","info":[21,24.14,0,0.0,0,0.0,1,50.0]},"RJ":{"fillKey":"#ffffff","info":[31,35.63,2,14.29,3,27.27,0,0.0]},"TN":{"fillKey":"#ffffff","info":[10,11.49,2,14.29,1,9.09,0,0.0]},"TS":{"fillKey":"#ffffff","info":[22,25.29,10,71.43,1,9.09,0,0.0]},"CH":{"fillKey":"#ffffff","info":[6,6.9,0,0.0,0,0.0,0,0.0]},"JK":{"fillKey":"#ffffff","info":[4,4.6,0,0.0,0,0.0,0,0.0]},"LK":{"fillKey":"#ffffff","info":[13,14.94,0,0.0,0,0.0,0,0.0]},"UP":{"fillKey":"#ffffff","info":[32,36.78,1,7.14,9,81.82,0,0.0]},"UK":{"fillKey":"#ffffff","info":[3,3.45,0,0.0,0,0.0,0,0.0]},"WB":{"fillKey":"#808080","info":[7,8.05,0,0.0,0,0.0,1,50.0]}}}} 2 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | India 7 | 22 | 23 | 24 | 25 | 26 | 27 |
28 | 33 | 169 | 170 | 171 | -------------------------------------------------------------------------------- /datamaps.ind.min.js: -------------------------------------------------------------------------------- 1 | !function(){function a(a,b,c){"undefined"==typeof c&&(c=b,optionsValues=void 0);var d="undefined"!=typeof a?a:b;if("undefined"==typeof d)return null;if("function"==typeof d){var e=[c];return c.geography&&(e=[c.geography,c.data]),d.apply(null,e)}return d}function b(a,b,c){return this.svg=n.select(a).append("svg").attr("width",c||a.offsetWidth).attr("data-width",c||a.offsetWidth).attr("class","datamap").attr("height",b||a.offsetHeight).style("overflow","hidden"),this.options.responsive&&(n.select(this.options.element).style({position:"relative","padding-bottom":100*this.options.aspectRatio+"%"}),n.select(this.options.element).select("svg").style({position:"absolute",width:"100%",height:"100%"}),n.select(this.options.element).select("svg").select("g").selectAll("path").style("vector-effect","non-scaling-stroke")),this.svg}function c(a,b){var c,d,e=b.width||a.offsetWidth,f=b.height||a.offsetHeight,g=this.svg;return b&&"undefined"==typeof b.scope&&(b.scope="world"),"usa"===b.scope?c=n.geo.albersUsa().scale(e).translate([e/2,f/2]):"world"===b.scope&&(c=n.geo[b.projection]().scale((e+1)/2/Math.PI).translate([e/2,f/("mercator"===b.projection?1.45:1.8)])),"orthographic"===b.projection&&(g.append("defs").append("path").datum({type:"Sphere"}).attr("id","sphere").attr("d",d),g.append("use").attr("class","stroke").attr("xlink:href","#sphere"),g.append("use").attr("class","fill").attr("xlink:href","#sphere"),c.scale(250).clipAngle(90).rotate(b.projectionConfig.rotation)),d=n.geo.path().projection(c),{path:d,projection:c}}function d(){n.select(".datamaps-style-block").empty()&&n.select("head").append("style").attr("class","datamaps-style-block").html('.datamap path.datamaps-graticule { fill: none; stroke: #777; stroke-width: 0.5px; stroke-opacity: .5; pointer-events: none; } .datamap .labels {pointer-events: none;} .datamap path {stroke: #FFFFFF; stroke-width: 1px;} .datamaps-legend dt, .datamaps-legend dd { float: left; margin: 0 3px 0 0;} .datamaps-legend dd {width: 20px; margin-right: 6px; border-radius: 3px;} .datamaps-legend {padding-bottom: 20px; z-index: 1001; position: absolute; left: 4px; font-size: 12px; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;} .datamaps-hoverover {display: none; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; } .hoverinfo {padding: 4px; border-radius: 1px; background-color: #FFF; box-shadow: 1px 1px 5px #CCC; font-size: 12px; border: 1px solid #CCC; } .hoverinfo hr {border:1px dotted #CCC; }')}function e(b){var c=this.options.fills,d=this.options.data||{},e=this.options.geographyConfig,f=this.svg.select("g.datamaps-subunits");f.empty()&&(f=this.addLayer("datamaps-subunits",null,!0));var g=o.feature(b,b.objects[this.options.scope]).features;e.hideAntarctica&&(g=g.filter(function(a){return"ATA"!==a.id})),e.hideHawaiiAndAlaska&&(g=g.filter(function(a){return"HI"!==a.id&&"AK"!==a.id}));var h=f.selectAll("path.datamaps-subunit").data(g);h.enter().append("path").attr("d",this.path).attr("class",function(a){return"datamaps-subunit "+a.id}).attr("data-info",function(a){return JSON.stringify(d[a.id])}).style("fill",function(b){var e,f=d[b.id];return f&&f.fillKey&&(e=c[a(f.fillKey,{data:d[b.id],geography:b})]),"undefined"==typeof e&&(e=a(f&&f.fillColor,c.defaultFill,{data:d[b.id],geography:b})),e}).style("stroke-width",e.borderWidth).style("stroke",e.borderColor)}function f(){function b(){this.parentNode.appendChild(this)}var c=this.svg,d=this,e=this.options.geographyConfig;(e.highlightOnHover||e.popupOnHover)&&c.selectAll(".datamaps-subunit").on("mouseover",function(f){var g=n.select(this),h=d.options.data[f.id]||{};if(e.highlightOnHover){var i={fill:g.style("fill"),stroke:g.style("stroke"),"stroke-width":g.style("stroke-width"),"fill-opacity":g.style("fill-opacity")};g.style("fill",a(h.highlightFillColor,e.highlightFillColor,h)).style("stroke",a(h.highlightBorderColor,e.highlightBorderColor,h)).style("stroke-width",a(h.highlightBorderWidth,e.highlightBorderWidth,h)).style("fill-opacity",a(h.highlightFillOpacity,e.highlightFillOpacity,h)).attr("data-previousAttributes",JSON.stringify(i)),/((MSIE)|(Trident))/.test(navigator.userAgent)||b.call(this)}e.popupOnHover&&d.updatePopup(g,f,e,c)}).on("mouseout",function(){var a=n.select(this);if(e.highlightOnHover){var b=JSON.parse(a.attr("data-previousAttributes"));for(var c in b)a.style(c,b[c])}a.on("mousemove",null),n.selectAll(".datamaps-hoverover").style("display","none")})}function g(a,b,c){if(b=b||{},this.options.fills){var d="
",e="";b.legendTitle&&(d="

"+b.legendTitle+"

"+d);for(var f in this.options.fills){if("defaultFill"===f){if(!b.defaultFillName)continue;e=b.defaultFillName}else e=b.labels&&b.labels[f]?b.labels[f]:f+": ";d+="
"+e+"
",d+='
 
'}d+="
";n.select(this.options.element).append("div").attr("class","datamaps-legend").html(d)}}function h(a,b){var c=n.geo.graticule();this.svg.insert("path",".datamaps-subunits").datum(c).attr("class","datamaps-graticule").attr("d",this.path)}function i(b,c,d){var e=this;this.svg;if(!c||c&&!c.slice)throw"Datamaps Error - arcs must be an array";for(var f=0;f-1&&(g=-2.5),"NY"===e.id&&(g=-1),"MI"===e.id&&(h=18),"LA"===e.id&&(g=13);var i,j;i=f[0]-g,j=f[1]+h;var k=["VT","NH","MA","RI","CT","NJ","DE","MD","DC"].indexOf(e.id);if(k>-1){var l=d[1];i=d[0],j=l+k*(2+(b.fontSize||12)),a.append("line").attr("x1",i-3).attr("y1",j-5).attr("x2",f[0]).attr("y2",f[1]).style("stroke",b.labelColor||"#000").style("stroke-width",b.lineWidth||1)}return a.append("text").attr("x",i).attr("y",j).style("font-size",(b.fontSize||10)+"px").style("font-family",b.fontFamily||"Verdana").style("fill",b.labelColor||"#000").text(e.id),"bar"})}function k(b,c,d){function e(a){return"undefined"!=typeof a&&"undefined"!=typeof a.latitude&&"undefined"!=typeof a.longitude}var f=this,g=this.options.fills,h=this.options.filters,i=this.svg;if(!c||c&&!c.slice)throw"Datamaps Error - bubbles must be an array";var j=b.selectAll("circle.datamaps-bubble").data(c,d.key);j.enter().append("svg:circle").attr("class","datamaps-bubble").attr("cx",function(a){var b;return e(a)?b=f.latLngToXY(a.latitude,a.longitude):a.centered&&(b=f.path.centroid(i.select("path."+a.centered).data()[0])),b?b[0]:void 0}).attr("cy",function(a){var b;return e(a)?b=f.latLngToXY(a.latitude,a.longitude):a.centered&&(b=f.path.centroid(i.select("path."+a.centered).data()[0])),b?b[1]:void 0}).attr("r",function(b){return d.animate?0:a(b.radius,d.radius,b)}).attr("data-info",function(a){return JSON.stringify(a)}).attr("filter",function(b){var c=h[a(b.filterKey,d.filterKey,b)];return c?c:void 0}).style("stroke",function(b){return a(b.borderColor,d.borderColor,b)}).style("stroke-width",function(b){return a(b.borderWidth,d.borderWidth,b)}).style("fill-opacity",function(b){return a(b.fillOpacity,d.fillOpacity,b)}).style("fill",function(b){var c=g[a(b.fillKey,d.fillKey,b)];return c||g.defaultFill}).on("mouseover",function(b){var c=n.select(this);if(d.highlightOnHover){var e={fill:c.style("fill"),stroke:c.style("stroke"),"stroke-width":c.style("stroke-width"),"fill-opacity":c.style("fill-opacity")};c.style("fill",a(b.highlightFillColor,d.highlightFillColor,b)).style("stroke",a(b.highlightBorderColor,d.highlightBorderColor,b)).style("stroke-width",a(b.highlightBorderWidth,d.highlightBorderWidth,b)).style("fill-opacity",a(b.highlightFillOpacity,d.highlightFillOpacity,b)).attr("data-previousAttributes",JSON.stringify(e))}d.popupOnHover&&f.updatePopup(c,b,d,i)}).on("mouseout",function(a){var b=n.select(this);if(d.highlightOnHover){var c=JSON.parse(b.attr("data-previousAttributes"));for(var e in c)b.style(e,c[e])}n.selectAll(".datamaps-hoverover").style("display","none")}),j.transition().duration(400).attr("r",function(b){return a(b.radius,d.radius,b)}),j.exit().transition().delay(d.exitDelay).attr("r",0).remove()}function l(a){return Array.prototype.slice.call(arguments,1).forEach(function(b){if(b)for(var c in b)null==a[c]&&(a[c]=b[c])}),a}function m(a){if("undefined"==typeof n||"undefined"==typeof o)throw new Error("Include d3.js (v3.0.3 or greater) and topojson on this page before creating a new map");return this.options=l(a,p),this.options.geographyConfig=l(a.geographyConfig,p.geographyConfig),this.options.projectionConfig=l(a.projectionConfig,p.projectionConfig),this.options.bubblesConfig=l(a.bubblesConfig,p.bubblesConfig),this.options.arcConfig=l(a.arcConfig,p.arcConfig),n.select(this.options.element).select("svg").length>0&&b.call(this,this.options.element,this.options.height,this.options.width),this.addPlugin("bubbles",k),this.addPlugin("legend",g),this.addPlugin("arc",i),this.addPlugin("labels",j),this.addPlugin("graticule",h),this.options.disableDefaultStyles||d(),this.draw()}var n=window.d3,o=window.topojson,p={scope:"world",responsive:!1,aspectRatio:.5625,setProjection:c,projection:"equirectangular",dataType:"json",data:{},done:function(){},fills:{defaultFill:"#ABDDA4"},filters:{},geographyConfig:{dataUrl:null,hideAntarctica:!0,hideHawaiiAndAlaska:!1,borderWidth:1,borderColor:"#FDFDFD",popupTemplate:function(a,b){return'
'+a.properties.name+"
"},popupOnHover:!0,highlightOnHover:!0,highlightFillColor:"#FC8D59",highlightBorderColor:"rgba(250, 15, 160, 0.2)",highlightBorderWidth:2},projectionConfig:{rotation:[97,0]},bubblesConfig:{borderWidth:2,borderColor:"#FFFFFF",popupOnHover:!0,radius:null,popupTemplate:function(a,b){return'
'+b.name+"
"},fillOpacity:.75,animate:!0,highlightOnHover:!0,highlightFillColor:"#FC8D59",highlightBorderColor:"rgba(250, 15, 160, 0.2)",highlightBorderWidth:2,highlightFillOpacity:.85,exitDelay:100,key:JSON.stringify},arcConfig:{strokeColor:"#DD1C77",strokeWidth:1,arcSharpness:1,animationSpeed:600}};m.prototype.resize=function(){var a=this,b=a.options;if(b.responsive){var c=b.element.clientWidth,d=n.select(b.element).select("svg").attr("data-width");n.select(b.element).select("svg").selectAll("g").attr("transform","scale("+c/d+")")}},m.prototype.draw=function(){function a(a){b.options.dataUrl&&n[b.options.dataType](b.options.dataUrl,function(a){if("csv"===b.options.dataType&&a&&a.slice){for(var c={},d=0;d