shawnbot/topogram

How can make d3-cartogram works on a NULL projection?

Closed this issue · 1 comments

I have a map already with real x,y pixel place, and need no projection.
so I made this change in the demo code:

  // var proj = d3.geo.albersUsa(),
  var proj = null,

and the carto code fails with:

  TypeError: projection is not a function cartogram.js:49

at

  out1[i1] = projection(tf(topology.arcs[i2][i1]));

So, is it possible to make d3-cartogram works on a NULL projection?

Sorry for taking so long to get to this. You should be able to provide an identity function as the projection, like so:

var cartogram = d3.cartogram()
  .projection(function(c) { return c; })
  .value(...);