diff --git a/index.html b/index.html index 1931a17..dc1a7d3 100644 --- a/index.html +++ b/index.html @@ -1,64 +1,105 @@ - - - - GeoJSON Map with D3.js - - - - + + + + GeoJSON Map with D3.js + + + + - - + // Draw the map + svg.selectAll("path") + .data(world.features) + .enter() + .append("path") + .attr("d", path) + .attr("class", "state") + .attr("fill", d => colorMap[d.properties.name]) + .append("title") // Tooltip + .text(d => d.properties.name) + .each(function(d) { + map1.set(d.properties.name, d3.geoCentroid(d)); + }) - + } + + // Load GeoJSON file + d3.json("india.json").then(drawMap) + + console.log(map1) + + +