Created
March 25, 2018 11:39
-
-
Save oneybee/7c699b9c84f5815ecd5d552cab24ef15 to your computer and use it in GitHub Desktop.
recharts piechart
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import Interactive from 'react-interactive'; | |
import { Switch, Route, Link } from 'react-router-dom'; | |
import ExampleTwoDeepComponent from './ExampleTwoDeepComponent'; | |
import PageNotFound from './PageNotFound'; | |
import s from '../styles/exampleComponent.style'; | |
import {PieChart, Pie, Legend} from 'Recharts'; | |
const data = [{name: 'Group A', value: 400}, {name: 'Group B', value: 300}, | |
{name: 'Group C', value: 300}, {name: 'Group D', value: 200}, | |
{name: 'Group E', value: 278}, {name: 'Group F', value: 189}] | |
const ExamplePageText = () => ( | |
<p style={s.p}> | |
<PieChart width={800} height={400}> | |
<Pie startAngle={360} endAngle={0} data={data} cx={200} cy={200} outerRadius={80} fill="#8884d8" label/> | |
</PieChart> | |
여기는 Example Component 입니다. | |
</p> | |
); | |
export default function ExampleComponent() { | |
return ( | |
<Switch> | |
<Route | |
exact path="/example/two-deep" | |
render={({ location }) => ( | |
<div> | |
<ExamplePageText /> | |
<ExampleTwoDeepComponent location={location} /> | |
</div> | |
)} | |
/> | |
<Route | |
exact path="/example" | |
render={() => ( | |
<div> | |
<ExamplePageText /> | |
<div style={s.pageLinkContainer}> | |
<Interactive | |
as={Link} | |
{...s.link} | |
to="/example/two-deep?field1=foo&field2=bar#boom!" | |
>Example two deep with query and hash</Interactive> | |
</div> | |
</div> | |
)} | |
/> | |
<Route component={PageNotFound} /> | |
</Switch> | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment