0

I'm a newbie in D3.js. I'm trying to create a map of Madrid neighbourhoods. I created a ,json from a .shp.

The problem is 1) when I want to use D3.v5 I can't see anything; and 2) when I use D3.v4 my map is too small and in the bottom left corner of the SVG. I have this fiddle with the v4 version.

Thank you.

patL
  • 2,259
  • 1
  • 17
  • 38
  • 2
    d3v5 uses promises for d3.json (see [here](https://stackoverflow.com/q/49768165/7106086)), so you need to change that when upgrading to v5. For sizing, this is the result of the parameters you have chosen, you could use: `projection.fitSize([width,height],geojson)` to set the projection paramaters based on the geographic features themselves: http://jsfiddle.net/0241kdty/ – Andrew Reid Dec 04 '18 at 18:39
  • 1
    @AndrewReid, just wonder why haven't you answered this question? Your comment solves all problems above. – Dracontis Dec 04 '18 at 20:32
  • @AndrewReid Thank you so much! That solves my problem. I'm still learning `javascript` and `d3.js and sometimes I find myself lost in the examples. If you answer the question I'll accept it. Thank you – patL Dec 04 '18 at 21:02

0 Answers0