Jump to: navigation, search

Difference between revisions of "Widget:PnChoropleths"

m
m
Line 237: Line 237:
 
return txt;
 
return txt;
 
}
 
}
 +
 +
}() );
 +
 +
 +
//Choropleth
 +
( function() {
 +
 +
window.IRHB = window.IRHB || {};
 +
var w = window.IRHB;
 +
var d = w.data;
 +
w.choro = {};
 +
var c = w.choro;
 +
var get = w.get;
 +
 +
 +
c.choropleth = function() {
 +
var curMap = w.map.curMap;
 +
var mp = get(curMap);
 +
var svg = mp.childNodes.length > 1 ? mp.firstChild.nextSibling.firstChild : mp.firstChild.firstChild;
 +
var paths = svg.getElementsByTagName("path");
 +
if (curMap === "navMap") {
 +
for (var key in d.counties) {
 +
var cur = d.counties[key];
 +
paths[cur.path].style.stroke = "#ffffff";
 +
}
 +
} else {
 +
if (w.nav.choroVar === "count") {
 +
for (var key in d.counties) {
 +
var cur = d.counties[key];
 +
paths[cur.path].style.fill = cur.totalcol;
 +
paths[cur.path].style.stroke = "#ffffff";
 +
}
 +
} else if (w.nav.choroVar === "area") {
 +
for (var key in d.counties) {
 +
var cur = d.counties[key];
 +
paths[cur.path].style.fill = cur.pnperkm2col;
 +
paths[cur.path].style.stroke = "#ffffff";
 +
}
 +
} else {
 +
for (var key in d.counties) {
 +
var cur = d.counties[key];
 +
paths[cur.path].style.fill = cur.pnperkm2popcol;
 +
paths[cur.path].style.stroke = "#ffffff";
 +
}
 +
}
 +
}
 +
};
  
 
}() );
 
}() );
 
</script></includeonly>
 
</script></includeonly>

Revision as of 12:45, 2 June 2019

This widget displays the navigation map on country and administrative division landing pages in the place-names section of IRHB. It takes no parameters.