Dorling Cartogram and Map Widget for React
MIT License
A simple widget to have a Dorling Cartogram that also animates into a regular map.
Clone the repo : npm i react-dorling-map
.
In the docs
folders is an example SimpleDorling.js
that has the settings. More docs coming at some point but for now:
A React component that takes the following properties and produces either a map or a dorling cartogram.
true
to display geodata as a dorling cartogramneighbors
property that gives the array position of any neighboring features (in other words if feature 9 borders features 0, 5 and 43 it should have a neighbors: [0, 5, 43]
in its properties
. While this isn't strictly required it will make things easier. Labeling by default is the id
value of the feature. There is a world.json
file in the docs
folder that doesn't have Antarctica but does have neighbors and isocodes.mapData
features based on shared id
values.d3-geo
projection. Default projection is the horrible Mercator projection so good luck sailing ships in the 18th century you goons.[width, height]
in pixelsgeoStyle
setting if no value is sent.id
property of the features or set to a function that takes the feature and returns a string or SVG JSX.d => {console.info(d)}
. There's no built-in tooltips but the passed element has x and y information for you to generate tooltips. Passed undefined
onMouseLeave.