
Product
Socket for Jira Is Now Available
Socket for Jira lets teams turn alerts into Jira tickets with manual creation, automated ticketing rules, and two-way sync.
react-d3-pie-chart
Advanced tools
React component for rendering pie chart with d3
$ npm i -S react react-dom react-d3-pie-chart
$ npm run demo
$ npm run bundle
| Parameter | Type |
|---|---|
| data (required) | array |
| colors (optional) | array |
| width (optional) | number |
| height (optional) | number |
| transition (optional) | number |
| renderLabel (optional) | function |
import React, { PureComponent } from 'react';
import { render } from 'react-dom';
import fp from 'lodash/fp';
import ReactD3PieChart from '../src';
const appRoot = document.getElementById('root');
class DemoApp extends PureComponent {
constructor(props) {
super(props);
this.state = {
data: [
{ label: 'A', value: 10 },
{ label: 'B', value: 22 },
{ label: 'C', value: 5 },
{ label: 'D', value: 0 },
{ label: 'E', value: 8 },
],
};
}
handleClick = () => {
const lastData = fp.last(this.state.data);
const { label } = lastData;
const newLabel = String.fromCharCode(label.charCodeAt() + 1);
const newValue = Math.floor(Math.random() * 31);
this.setState({
data: [
...this.state.data,
{ label: newLabel, value: newValue },
],
});
}
renderLabel = d => `Label is ${d.data.label}`
render() {
return (
<main>
<ReactD3PieChart data={this.state.data} tooltip renderLabel={this.renderLabel} />
<button onClick={this.handleClick}>Add Data</button>
</main>
);
}
}
render(<DemoApp />, appRoot);
1.0.0
1.0.1
renderLabel method1.0.2
setState)1.0.3
commonjsFAQs
React component for rendering pie chart with d3
We found that react-d3-pie-chart demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Socket for Jira lets teams turn alerts into Jira tickets with manual creation, automated ticketing rules, and two-way sync.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.