Why my map is in rectangle shape? I used older JSON file It gave me the output correctly but for this new one JSON file, It's giving me map in rectangle shape. Code is the same just minor changes had made like extracting state name and district name, rest are same.
Old Json file output: https://plnkr.co/edit/Z9A95awIrUCjPp9B
New Json file output: https://plnkr.co/edit/UurfR1CtfekldUrr?open=lib%2Fscript.js&preview
It should look like this https://github.com/ninjakx/Dc.-visualization-dashboard/blob/master/test_map.json
Since my json file is too large so I am taking a single district just to post here. I will be displaying the whole indian map.
Changes made:
india.selectAll("path")
.data(json.features)
.enter().append("path")
.attr("d", path)
.style("fill", colors[0])
.style("opacity", 0.5)
.on('click', function (d, i) {
d3.select(this).transition().duration(300).style("opacity", 1);
div.transition().duration(300)
.style("opacity", 1)
div.text(d.properties.statename+ ':' + d.properties.distname) //<---- Here only
.style("left", (d3.event.pageX) + "px")
.style("top", (d3.event.pageY - 30) + "px");
})