React D3 Pie Chart
React component for rendering pie chart with d3
Getting Started
$ npm i -S react react-dom react-d3-pie-chart
Development
$ npm run demo
Bundling for production
$ npm run bundle
How to Use
Parameters
Parameter | Type |
---|---|
data (required) | array |
colors (optional) | array |
width (optional) | number |
height (optional) | number |
transition (optional) | number |
renderLabel (optional) | function |
Basic
;;;; const appRoot = document; { superprops; thisstate = data: label: 'A' value: 10 label: 'B' value: 22 label: 'C' value: 5 label: 'D' value: 0 label: 'E' value: 8 ; } { const lastData = fp; const label = lastData; const newLabel = String; const newValue = Math; this; } `Label is ` { return <main> <ReactD3PieChart data=thisstatedata tooltip renderLabel=thisrenderLabel /> <button onClick=thishandleClick>Add Data</button> </main> ; } ;
Change Log
1.0.0
- Initial release
1.0.1
- Migrate webpack v4
- Fix
renderLabel
method
1.0.2
- Fix bug (to not pass the callback in
setState
)
1.0.3
- change library target into
commonjs