Commit 65df7239 authored by Okhin's avatar Okhin

Fix #19 updating the european map in topojson format

parent 9103196a
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
$(document).ready(function() {
var onCountryClick = function(target) {
window.location='/list/'+target.iso2+"/";
window.location='/list/'+target.id+"/";
};
$(function() {
/* we're gonna calculate the colors for our countries */
......@@ -12,7 +12,7 @@ $(document).ready(function() {
.domain([minValue, maxValue])
.range(['#EFEFEF', '#02386F']);
data.forEach(function(item) {
var iso = item.iso2,
var iso = item.id,
value = item.w;
dataset[iso] = { numberOfCases: value, fillColor: paletteScale(value)};
});
......@@ -33,7 +33,7 @@ $(document).ready(function() {
data: dataset,
fills: {defaultFill: '#F5F5F5'},
geographyConfig: {
dataUrl: '/site_media/eu.topojson',
dataUrl: '/site_media/europe.topojson',
borderColor: '#DEDEDE',
highlightBorderWidth: 2,
highLightFillColor: function(geo) {
......@@ -43,74 +43,16 @@ $(document).ready(function() {
popupTemplate: function(geo, data) {
if (!data){ return };
return ['<div class="hoverinfo">',
'<strong>', geo.properties.name, '</strong>',
'<strong>', geo.properties.NAME, '</strong>',
'<br><strong>', data.numberOfCases, '</strong> Reported cases',
'</div>'].join('')
}
},
done: function(datamap) {
datamap.svg.selectAll('.datamaps-subunit').on('click', function(geography) {
window.location='/list/'+geography.properties.iso2+"/";
window.location='/list/'+geography.id+"/";
});
}
});
/* window.map = $K.map('#map');
map.loadMap('/site_media/eu.svg', function(map) {
map
.addLayer('eu', 'bgback')
.addLayer('eu', 'bg')
.addLayer('eu', 'bgstroke')
.addLayer({'id': 'countries', 'className': 'context'})
.addLayer('graticule')
.addLayer({'id': 'eu',
'className': 'fg',
'tooltip': {
content: function(obj,foo) {
var count=0;
if(data) {
for(var i=0;i<data.length;i++) {
if(data[i].id==foo.data.id) {
count=data[i].w;
break;
}
}
}
if(count>0) {
return foo.data.name+"<br />"+count+" reported cases";
} else {
return foo.data.name;
}
}
},
'key': "id"
});
map.onLayerEvent('click', onCountryClick, 'fg')
map.addFilter('oglow', 'glow', { size: 3, color: '#988', strength: 1, inner: false });
map.getLayer('bgback').applyFilter('oglow');
map.addFilter('myglow', 'glow', { size: 2, color: '#945C1B', inner: true });
map.getLayer('bg').applyFilter('myglow');
colorscale = new chroma.ColorScale({
colors: chroma.brewer.YlGnBu,
limits: chroma.limits(data, 'q', 6, 'w')
});
if(data) {
map.choropleth({
data: data,
layer: 'fg',
key: 'id',
colors: function(d) {
if (d == null) return '#fff';
return colorscale.getColor(d['w']);
},
duration: 0
});
}
}); */
});
});
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment