score:3

Accepted answer

The problem is that you are not fitting the projection to anything with .fitSize

fitSize takes two parameters, an array with width and height and a geojson feature: projection.fitSize([width,height],geojson). You meed to specify what geojson feature (or feature collextion) should be fit to your specified dimensions. This method sets the scale and translate, so without a feature, these will not be set and your projection will return NaN values.

As your geojson is not loaded until your d3.json callback is triggered, this method must be invoked within the callback. Also note that the method needs a feature or feature collection, not an array of features (data, not data.features in your case):

projection.fitSize([960,960],data)

Related Query

More Query from same tag