Skip to content

Instantly share code, notes, and snippets.

@kocisov
Created April 1, 2018 06:36
Show Gist options
  • Save kocisov/07169c4870cff8ff80f7011e265c9813 to your computer and use it in GitHub Desktop.
Save kocisov/07169c4870cff8ff80f7011e265c9813 to your computer and use it in GitHub Desktop.

Revisions

  1. kocisov created this gist Apr 1, 2018.
    35 changes: 35 additions & 0 deletions index.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,35 @@
    import * as React from 'react'
    import { render } from 'react-dom'
    import { PieChart, Pie, Cell } from 'recharts'

    const data = [
    {
    name: 'Low thing',
    value: 3,
    color: '#d0d0d0',
    },
    {
    name: 'Medium thing',
    value: 20,
    color: '#e2e',
    },
    ]

    const Chart = (
    <PieChart width={250} height={250}>
    <Pie
    data={data}
    dataKey="value"
    nameKey="name"
    innerRadius={55}
    outerRadius={80}
    >
    {data.map((entry, index) => (
    <Cell key={`cell-${index}`} fill={entry.color} />
    ))}
    </Pie>
    </PieChart>
    )

    const node = document.getElementById('root')
    render(<Chart />, node)