2

I'm trying to adapt this example http://prag.ma/code/d3-cartogram/ to show information about obesity in 2002, 2005 and 2010 around the world. This the visualization: http://datauy.github.io/obesity-cartogram with a link to the code in the same page.

The problem I'm trying to resolve is that the shapes are not being distorted like in the original example with the alberusa projection. The colors seems to be mapped just fine but for some reason I can't distort the map. I tried changing the scale and looking into the cartogram.js code but I don't see anything that could be the problem. If I change the data to have a larger difference then I see the color difference but nothing on shape.

Any clue what is happening? Thanks!

MichaelChirico
  • 33,841
  • 14
  • 113
  • 198
gaba
  • 73
  • 1
  • 6
  • Does it work if you use the albers USA projection? – Lars Kotthoff Sep 10 '13 at 12:34
  • Maybe that is the problem. I though you could use the albers to project the whole world and not just the USA. I tried with the equirectangular projection but I had the same problem. The code in https://github.com/datauy/obesity-cartogram/blob/master/index.html is using equirectangular projection. Do you have a suggestion for other projection to use in this case? – gaba Sep 10 '13 at 20:16
  • It should work with any projection, that's why I'm asking. – Lars Kotthoff Sep 11 '13 at 07:38
  • There is an example of a world map cartogram that is adapted from the same code here http://th-mayer.de/cartogram/ It uses the mercator projection, although I also think that it should work with any projection. You could try using the shapefile from that example. – ramiro Dec 17 '13 at 19:16

1 Answers1

0

The problem is due to Fiji and Russia having project extents which cross the edge and return to the left border. When the cartogram.js calculations complete, the path has a negative value in it which is causing the problem. I'm trying to resolve it myself and will update asap.