|
|
@ -252,6 +252,11 @@ function drawMap(world) {
|
|
|
|
states.append("path")
|
|
|
|
states.append("path")
|
|
|
|
.attr("d", path)
|
|
|
|
.attr("d", path)
|
|
|
|
.attr("class", d => stateOrDistrictOrLanguage(d))
|
|
|
|
.attr("class", d => stateOrDistrictOrLanguage(d))
|
|
|
|
|
|
|
|
.attr("id", function(d) {
|
|
|
|
|
|
|
|
if (stateOrDistrictOrLanguage(d) === "language") {
|
|
|
|
|
|
|
|
return languages[d.properties.lang_name.toLowerCase()].code + "langMap";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
})
|
|
|
|
.attr("fill", function(d) {
|
|
|
|
.attr("fill", function(d) {
|
|
|
|
if (stateOrDistrictOrLanguage(d) === "language") {
|
|
|
|
if (stateOrDistrictOrLanguage(d) === "language") {
|
|
|
|
return languages[d.properties.lang_name.toLowerCase()].color;
|
|
|
|
return languages[d.properties.lang_name.toLowerCase()].color;
|
|
|
@ -272,7 +277,8 @@ function drawMap(world) {
|
|
|
|
.append("title") // Tooltip
|
|
|
|
.append("title") // Tooltip
|
|
|
|
.text(d => d.properties.district);
|
|
|
|
.text(d => d.properties.district);
|
|
|
|
|
|
|
|
|
|
|
|
states.append("text")
|
|
|
|
const textItems = svg.selectAll("g.textItem").data(world.features).enter().append("g");
|
|
|
|
|
|
|
|
textItems.append("text")
|
|
|
|
.attr("x", function(d) {
|
|
|
|
.attr("x", function(d) {
|
|
|
|
if (stateOrDistrictOrLanguage(d) == "language") {
|
|
|
|
if (stateOrDistrictOrLanguage(d) == "language") {
|
|
|
|
rtv = projection(d3.geoCentroid(d))[0];
|
|
|
|
rtv = projection(d3.geoCentroid(d))[0];
|
|
|
@ -338,7 +344,7 @@ function drawMap(world) {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
// Romanization
|
|
|
|
// Romanization
|
|
|
|
states.append("text")
|
|
|
|
textItems.append("text")
|
|
|
|
.attr("x", d => stateOrDistrictOrLanguage(d) == "language" ?
|
|
|
|
.attr("x", d => stateOrDistrictOrLanguage(d) == "language" ?
|
|
|
|
document.getElementById(d.properties.lang_code + "Text").getAttribute("x") :
|
|
|
|
document.getElementById(d.properties.lang_code + "Text").getAttribute("x") :
|
|
|
|
projection(d3.geoCentroid(d))[0])
|
|
|
|
projection(d3.geoCentroid(d))[0])
|
|
|
@ -362,7 +368,7 @@ function drawMap(world) {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
// Language
|
|
|
|
// Language
|
|
|
|
states.append("text")
|
|
|
|
textItems.append("text")
|
|
|
|
.attr("x", d => stateOrDistrictOrLanguage(d) == "language" ?
|
|
|
|
.attr("x", d => stateOrDistrictOrLanguage(d) == "language" ?
|
|
|
|
document.getElementById(d.properties.lang_code + "Text").getAttribute("x") :
|
|
|
|
document.getElementById(d.properties.lang_code + "Text").getAttribute("x") :
|
|
|
|
projection(d3.geoCentroid(d))[0])
|
|
|
|
projection(d3.geoCentroid(d))[0])
|
|
|
@ -396,6 +402,12 @@ function drawMap(world) {
|
|
|
|
const coordinates = [77.69916967457782,23.389970772934166];
|
|
|
|
const coordinates = [77.69916967457782,23.389970772934166];
|
|
|
|
const [xCoord, yCoord] = projection(coordinates);
|
|
|
|
const [xCoord, yCoord] = projection(coordinates);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
document.querySelectorAll(".language").
|
|
|
|
|
|
|
|
forEach(function(element) {
|
|
|
|
|
|
|
|
element.addEventListener("mouseover", toggleLanguageDisplay);
|
|
|
|
|
|
|
|
element.addEventListener("mouseout", toggleLanguageDisplay);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
// svg.append("text")
|
|
|
|
// svg.append("text")
|
|
|
|
// .attr("x", xCoord)
|
|
|
|
// .attr("x", xCoord)
|
|
|
|
// .attr("y", yCoord)
|
|
|
|
// .attr("y", yCoord)
|
|
|
|