Giter Site home page Giter Site logo

react-pie3d's Introduction

React 3d pie/donut chart

This library is for drawing nice looking pie/donut charts with d3js.

Here is the link to the demo

image

##How to install

npm install react-pie3d

How to use it

You can do that both ways:

import Pie3D from 'react-pie3d'

or

require('react-pie3d')

In file:

<Pie3D data={[10, 20, 30]}/>

Pie3D have to props:

  • data - (requierd) array of numbers or objects
  • config - object with chart config

data can be just simiple array of numbers [10, 20, 30] or array of objects:

Exmaple

var data = [
  {
    value: 10,
    color: 'red',
    label: 'No'
  },
  {
    value: 20,
    color: 'green',
    label: 'Yes'
  },
  {
    value: 5,
    color: 'silver',
    label: 'Others'
  }
];
  • value - number
  • color - string
  • label - string

Config

config - Object

Parameter Default Decryption
ir 60 Number (min: 0, max: 100) Inner radius in %
h 40 Number (min: 0) Height of walls in px
angle 40 Number (min: 0, max: 90) Angle of chart in degrees, when 90 the chart become normal flat pie chart
size 100 Number (min: 0, max: 100) size in inner html tag in %
onSliceSelect null Function on slice click, d => {}

*d => {}

d = {
	value: ...,        //number
    startAngle: ...,   //number
    endAngle: ...,     //number
    index: ...,        //number
    color: ...,   	   //string
    label: ...		   //string
}

TO DO:

  • Labels overriding
  • Animations
  • Tooltips
  • More configurable

License

MIT License 2016 © woles

react-pie3d's People

Watchers

Munna Bhakta avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.