问题
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!
回答1:
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.
来源:https://stackoverflow.com/questions/18707178/using-cartogram-js-for-visualizing-information-in-a-global-map