Widget:Test1: Difference between revisions
From International Robin Hood Bibliography
mNo edit summary |
mNo edit summary |
||
Line 108: | Line 108: | ||
cur.pnperkm2popcol = getColour(cur.pnperkm2popidx); | cur.pnperkm2popcol = getColour(cur.pnperkm2popidx); | ||
} | } | ||
console.log(d.counties); | //console.log(d.counties); | ||
console.log(d.England); | //console.log(d.England); | ||
} | } | ||
Line 268: | Line 268: | ||
var mp = w.get(m.curMap); | var mp = w.get(m.curMap); | ||
var width = 496, height = 550; | var width = 496, height = 550; | ||
var projection = d3.geo.conicEqualArea().scale(5165.269352442655).center([-1.4602454263940616,52.55675714793008]).parallels([49.95898294542323,55.81107189358492]).rotate([1.4602454263940616]).translate([202.798519176517,306.70813464248357]); | //var projection = d3.geo.conicEqualArea().scale(5165.269352442655).center([-1.4602454263940616,52.55675714793008]).parallels([49.95898294542323,55.81107189358492]).rotate([1.4602454263940616]).translate([202.798519176517,306.70813464248357]); | ||
var path = d3.geo.path().projection(projection); | //var path = d3.geo.path().projection(projection); | ||
var div = "div#" + m.curMap; | var div = "div#" + m.curMap; | ||
var svg = d3.select(div).append("svg").attr("width", width).attr("height", height); | //var svg = d3.select(div).append("svg").attr("width", width).attr("height", height); | ||
if (mp.childNodes.length > 1) { | if (mp.childNodes.length > 1) { | ||
mp.firstChild.nextSibling.style.display = "none"; | mp.firstChild.nextSibling.style.display = "none"; | ||
} | } | ||
features = svg.append("g").attr("class","features"); | //features = svg.append("g").attr("class","features"); | ||
tooltip = d3.select("body").append("div").attr("class","ttip"); | //tooltip = d3.select("body").append("div").attr("class","ttip"); | ||
d3.xml("/wiki/geo/england/country/England.svg",function(error,geodata) { | d3.xml("/wiki/geo/england/country/England.svg") | ||
.mimeType("image/svg+xml").get(function(error, xml) { | |||
//d3.xml("/wiki/geo/england/country/England.svg",function(error,geodata) { | |||
console.log("OK 2"); | console.log("OK 2"); | ||
if (!error) { | if (!error) { | ||
console.log("OK 3"); | console.log("OK 3"); | ||
features.selectAll("path").data(geodata.features).enter().append("path").attr("d",path).on("mouseover",showTooltip).on("mousemove",moveTooltip).on("mouseout",hideTooltip).on("click",clicked); | //features.selectAll("path").data(geodata.features).enter().append("path").attr("d",path).on("mouseover",showTooltip).on("mousemove",moveTooltip).on("mouseout",hideTooltip).on("click",clicked); | ||
w.choro.choropleth(); | //w.choro.choropleth(); | ||
if (mp.childNodes.length > 1) { | if (mp.childNodes.length > 1) { | ||
mp.removeChild(mp.childNodes[0]); | mp.removeChild(mp.childNodes[0]); | ||
} | } | ||
mp.firstChild.style.display = "block"; | mp.firstChild.style.display = "block"; | ||
tooltipOffset = {x: 5, y: -25}; | //tooltipOffset = {x: 5, y: -25}; | ||
m.makeResponsive(div, svg); | //m.makeResponsive(div, svg); | ||
w.get(div).appendChild(xml.documentElement); | |||
} else { | } else { | ||
console.log("Øv: Error!"); | throw error; | ||
return console.log(error); | //console.log("Øv: Error!"); | ||
//return console.log(error); | |||
} | } | ||
}); | }); | ||
}; | }; | ||
Revision as of 17:04, 22 May 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.