react-simple-maps-canvas

0.0.1 • Public • Published

React Mapchart

!WIP: The aim of this react component library is to render mapcharts to canvas using a simple declarative api similar to react-simple-maps.

import { CanvasMap, Geographies, Geography } from "react-mapchart"
 
const MyMap = () => {
  return (
    <CanvasMap width={800} height={600}>
      <Geographies geography="https://cdn.jsdelivr.net/npm/world-atlas@2/countries-110m.json">
        {({geographies, highlighted}) =>
          geographies.map(geo =>
            <Geography
              key={geo.rsmKey}
              geography={geo}
              fill={highlighted === geo.rsmKey ? "#F53" : "#EEE"}
            />
          )
        }
      </Geographies>
    </CanvasMap>
  )
}

Package Sidebar

Install

npm i react-simple-maps-canvas

Weekly Downloads

0

Version

0.0.1

License

MIT

Unpacked Size

22.8 kB

Total Files

12

Last publish

Collaborators

  • zimrick