New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

d3-react-pie-chart

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

d3-react-pie-chart

A component library for data visualization with React and D3

latest
npmnpm
Version
1.0.15
Version published
Maintainers
1
Created
Source

A Simple React Pie Chart Component

Installation

npm i d3-react-pie-chart

Example Usage

import { PieChart } from 'd3-react-pie-chart';

const MyPieChart = () => {
    const sampleData = [
        {type: 'TypeA', value: 7}
        {type: 'TypeB', value: 4}
        {type: 'TypeC', value: 2}
        {type: 'TypeD', value: 2}
        {type: 'TypeE', value: 3}
        {type: 'TypeF', value: 5}
    ]
    const dataAccessorField: string = 'value' // field name of the data value
    const dataLabelField: string = 'type' // field name of the label value
    const innerRadius: number = 0.35 // OPTIONAL - creates a donut - Valid values 0 - 0.35
    const dimensions: { height: number } = {height: 300} // determines both height and width of the chart

  return 
    <PieChart 
        data={sampleData}
        dataAccessorField={dataAccessorField}
        dataLabelField={dataLabelField}
        dimensions={dimensions}
        innerRadius={innerRadius}
    />;
};

export default MyPieChart;

FAQs

Package last updated on 12 Mar 2022

Did you know?

Socket

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.

Install

Related posts