Widget:PlaceNamesChoropleths: Difference between revisions

From International Robin Hood Bibliography
mNo edit summary
mNo edit summary
(3 intermediate revisions by the same user not shown)
Line 13: Line 13:
}() );
}() );




Line 231: Line 232:
'<tr><td>Miscellaneous</td><td colspan="2">' + d.Miscellaneous + '</td></tr>' +  
'<tr><td>Miscellaneous</td><td colspan="2">' + d.Miscellaneous + '</td></tr>' +  
'<tr><td>Total count</td><td colspan="2">' + d.total + '</td></tr>' +  
'<tr><td>Total count</td><td colspan="2">' + d.total + '</td></tr>' +  
'<tr><td>Count idx.</td><td>' + d.totalidx + '</td><td style="background-color:#' + d.totalcol + '; width:1.5em;"></td></tr>' +  
'<tr><td>Count idx.</td><td>' + d.totalidx + '</td><td style="background-color:' + d.totalcol + '; width:1.5em;"></td></tr>' +  
'<tr><td>PN/km<sup>2</sup> idx.</td><td>' + d.pnperkm2idx + '</td><td style="background-color:#' + d.pnperkm2col + '; width:1.5em;"></td></tr>' +  
'<tr><td>PN/km<sup>2</sup> idx.</td><td>' + d.pnperkm2idx + '</td><td style="background-color:' + d.pnperkm2col + '; width:1.5em;"></td></tr>' +  
'<tr><td>PN/km<sup>2</sup>/pop. idx.</td><td>' + d.pnperkm2popidx + '</td><td style="background-color:#' + d.pnperkm2popcol + '; width:1.5em;"></td></tr>' +  
'<tr><td>PN/km<sup>2</sup>/pop. idx.</td><td>' + d.pnperkm2popidx + '</td><td style="background-color:' + d.pnperkm2popcol + '; width:1.5em;"></td></tr>' +  
'</tbody>';
'</tbody>';
return txt;
return txt;
Line 239: Line 240:


}() );
}() );




Line 286: Line 288:


}() );
}() );




Line 358: Line 361:
svg += '</path></svg>';
svg += '</path></svg>';
elem.innerHTML = svg;
elem.innerHTML = svg;
elem.firstElementChild.firstElementChild.style.strokeWidth = "0px";
};
};
Line 381: Line 385:
tooltip.style("display","none");
tooltip.style("display","none");
}
}
}() );
//Navigation
( function() {
window.IRHB = window.IRHB || {};
var w = window.IRHB;
w.nav = {};
var n = w.nav;
var get = w.get;
var m = w.map;
var choroLegend = {
'count': { 's1': 'Count', 's2': 'Area', 's3': 'Area&ndash;Population'},
'area': { 's1': 'Area', 's2': 'Count', 's3': 'Area&ndash;Population'},
'areaPop': { 's1': 'Area&ndash;Population', 's2': 'Count', 's3': 'Area'}
}
n.choroVar = "count";
function selectChoroVar(event) {
var targId = event.target.id;
if (targId === "choroMapLegend2") {
if (n.choroVar !== "count") {
n.choroVar = "count";
} else {
n.choroVar = "area";
}
} else {
if (n.choroVar !== "areaPop") {
n.choroVar = "areaPop";
} else {
n.choroVar = "area";
}
}
get("choroMapLegend1").innerHTML = choroLegend[n.choroVar].s1;
get("choroMapLegend2").innerHTML = choroLegend[n.choroVar].s2;
get("choroMapLegend3").innerHTML = choroLegend[n.choroVar].s3;
w.choro.choropleth();
}
n.prepareNav = function() {
var d = get("choroMapLegend2");
d.onclick = selectChoroVar;
d.style.fontWeight = 600;
d.style.color = "#4d8375";
d.style.cursor = "pointer";
d = get("choroMapLegend3");
d.onclick = selectChoroVar;
d.style.fontWeight = 600;
d.style.color = "#4d8375";
d.style.cursor = "pointer";
get("choroMap").style.backgroundColor = "#f9fafa";
n.toggleNav();
};
n.toggleNav = function() {
get("choroMapLegend1").innerHTML = choroLegend[n.choroVar].s1;
get("choroMapLegend2").innerHTML = choroLegend[n.choroVar].s2;
get("choroMapLegend3").innerHTML = choroLegend[n.choroVar].s3;
get("choroMap").style.display = "block";
get("choroMapLegend").style.display = "block";
m.curMap = "choroMap";
m.initMap();
};
}() );
( function() {
    var w = window.IRHB;
    var gjson = "https://www.irhb.org/wiki/geo/england/country/England.json";
    var script = document.createElement('script');
    script.type = 'text/javascript';
    script.src = "https://www.irhb.org/wiki/js/d3js/d3.v3.min.js";
    script.onload = w.nav.prepareNav;
    document.head.appendChild(script);
}() );
}() );
</script></includeonly>
</script></includeonly>

Revision as of 19:09, 7 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.