Remove testing code; use minified map JSON; hide spinner after map has loaded
This commit is contained in:
25
index.js
25
index.js
@@ -223,6 +223,10 @@ function drawMap(world) {
|
|||||||
districtLang.districts.push(d)
|
districtLang.districts.push(d)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Hide map load spinner after map has loaded
|
||||||
|
document.getElementById("mapLoadSpinner").classList.add("hide");
|
||||||
|
document.querySelector("svg").classList.add("show");
|
||||||
|
|
||||||
})
|
})
|
||||||
.append("title") // Tooltip
|
.append("title") // Tooltip
|
||||||
.text(d => d.properties.district);
|
.text(d => d.properties.district);
|
||||||
@@ -339,21 +343,20 @@ function drawMap(world) {
|
|||||||
} else {
|
} else {
|
||||||
d3.select(this).remove() // Only add this attribute if the element is a language
|
d3.select(this).remove() // Only add this attribute if the element is a language
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
|
|
||||||
let allLangs = []
|
let allLangs = []
|
||||||
|
|
||||||
const coordinates = [77.69916967457782,23.389970772934166];
|
const coordinates = [77.69916967457782,23.389970772934166];
|
||||||
const [xCoord, yCoord] = projection(coordinates);
|
const [xCoord, yCoord] = projection(coordinates);
|
||||||
|
|
||||||
svg.append("text")
|
// svg.append("text")
|
||||||
.attr("x", xCoord)
|
// .attr("x", xCoord)
|
||||||
.attr("y", yCoord)
|
// .attr("y", yCoord)
|
||||||
.attr("class", "testClass")
|
// .attr("class", "testClass")
|
||||||
.attr("text-anchor", "middle")
|
// .attr("text-anchor", "middle")
|
||||||
.attr("font-size", "12px")
|
// .attr("font-size", "12px")
|
||||||
.attr("fill", "black")
|
// .attr("fill", "black")
|
||||||
.text("Hello, Map!");
|
// .text("Hello, Map!");
|
||||||
// for (const [langId,lang] of Object.entries(languages)) {
|
// for (const [langId,lang] of Object.entries(languages)) {
|
||||||
// let geojson = {
|
// let geojson = {
|
||||||
// "type": "FeatureCollection",
|
// "type": "FeatureCollection",
|
||||||
@@ -377,4 +380,4 @@ function drawMap(world) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
d3.json("india_with_districts_with_languages.json").then(drawMap)
|
d3.json("india_with_districts_with_languages_min.json").then(drawMap)
|
||||||
|
Reference in New Issue
Block a user