Last active
August 19, 2016 20:07
-
-
Save viniciusdacal/7ea1fe2d4a080c990398a4f2464fe354 to your computer and use it in GitHub Desktop.
This file contains 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, {Component} from 'react'; | |
const { | |
LineChart, | |
Line, | |
XAxis, | |
YAxis, | |
CartesianGrid, | |
Tooltip, | |
Legend | |
} from 'recharts'; | |
const data = [ | |
{name: 'Page A', pv: 2400, amt: 2400}, | |
{name: 'Page B', pv: 1398, amt: 2210}, | |
{name: 'Page C', pv: 9800, amt: 2290}, | |
{name: 'Page D', pv: 3908, amt: 2000}, | |
{name: 'Page E', pv: 4800, amt: 2181}, | |
{name: 'Page F', pv: 3800, amt: 2500}, | |
{name: 'Page G', pv: 4300, amt: 2100}, | |
]; | |
class SimpleLineChart extends Component { | |
render () { | |
return ( | |
<LineChart | |
width={600} | |
height={300} | |
data={data} | |
margin={{top: 5, right: 30, left: 20, bottom: 5}} | |
> | |
<Line | |
type='monotone' | |
dataKey='pv' | |
stroke='#8884d8' | |
activeDot={{r: 8}} | |
/> | |
<CartesianGrid strokeDasharray='3 3'/> | |
<Tooltip/> | |
<YAxis/> | |
<XAxis dataKey='name'/> | |
<Legend /> | |
</LineChart> | |
); | |
} | |
} | |
export default SimpleLineChart; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment