1.1.1 • Published 5 years ago

react-d3-pie v1.1.1

Weekly downloads
2
License
MIT
Repository
github
Last release
5 years ago

react-d3-pie

React component to create a d3 pie chart

demo

test

Install

$ npm install react-d3-pie

Run Demo

git clone https://github.com/zuoq/react-d3-pie.git
cd react-d3-pie
npm install
npm demo

Usage

const initData = [
   {name: 'test1', value: 1},
   {name: 'test2', value: 2},
   {name: 'test3', value: 3}
];
import {Pie} from 'react-de-pie';
<Pie width={500}
     height={400}
     data={initData}
     colors={['red','green','yellow']}
     innerRadius={0.4}
     outerRadius={0.8}
/>

API

paramdescriptiontypedefault
widthThe width of the pie chart rendering area (unit: px)number500
widthThe height of the pie chart rendering area (unit: px)number400
dataThe data of the pie chart rendering areaarray {name: 'test1', value: 1}, {name: 'test2', value: 2}, {name: 'test3', value: 3}
colorsPie chart rendering colorsarrayd3.schemeCategory10
innerRadiusRelative multiple of the radius inside the pie chart (range 0~0.8)number0.4
outerRadiusRelative multiple of the outer radius of the pie chart (range 0~0.8)number0.8
  • note
    • When the width and height are too small, the text will be displayed in grammar
    • The innerRadius must be smaller than the outerRadius

Author

1.1.1

5 years ago

1.1.0

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago