Create deliciously declarative pie charts with (P)React.
This is currently in alpha; feel free to use it but don't get your hopes up
npm i @nicktomlin/pie
import {Pie, Slice} from '@nicktomlin/pie' // OR @nicktomlin/pie/dist/pie.preact
<Pie>
<Slice percent={0.1} fill='Coral' />
<Slice percent={0.7} fill='CornFlowerBlue' />
<Slice percent={0.2} fill='#00ab6b' />
</Pie>
- Actually renders a pie chart
- Preact compatible (vanilla without needing
preact-compat
) - Doughnut chart
- Top/Bottom Labels
- Hover effects (technically one could just pass props through to
Slice>
and be done with it but we could also make this easier)
- hard things stolen from a simple pie chart in SVG
- Structure stolen from Ryan Florence's "Compound Components" talk
- You should probably just use charts.js or d3
- Fork and clone this repo
- Make your changes
- Please add a test if possible
- Ensure that
npm test
passes - Open up a pull request