Fetch SVG size from HTML, instead of re-defining it in JS
This commit is contained in:
4
index.js
4
index.js
@@ -43,7 +43,9 @@ const colorMap = {
|
|||||||
const colors9 = ["#75d795", "#EFDFD8", "#D5F6FB", "#E5ECF8", "#F0EBD8", "#F7DFC2", "#B4D9EF", "#F8C57C", "#A4D8D8"]
|
const colors9 = ["#75d795", "#EFDFD8", "#D5F6FB", "#E5ECF8", "#F0EBD8", "#F7DFC2", "#B4D9EF", "#F8C57C", "#A4D8D8"]
|
||||||
|
|
||||||
function drawMap(world) {
|
function drawMap(world) {
|
||||||
const projection = d3.geoMercator().fitSize([1000,600], world)
|
const mapWidth = document.getElementById("indiaMap").getAttribute("width")
|
||||||
|
const mapHeight = document.getElementById("indiaMap").getAttribute("height")
|
||||||
|
const projection = d3.geoMercator().fitSize([mapWidth, mapHeight], world)
|
||||||
const path = d3.geoPath().projection(projection);
|
const path = d3.geoPath().projection(projection);
|
||||||
|
|
||||||
// Draw the map
|
// Draw the map
|
||||||
|
Reference in New Issue
Block a user