Created
April 15, 2017 02:57
-
-
Save guzmonne/cffe8635b591b79a677762f560270671 to your computer and use it in GitHub Desktop.
Chart element example
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 T from 'prop-types' | |
import Chart from './Chart.js' | |
import Background from './Background.js' | |
import Axis from './Axis.js' | |
import Bars from './Bars.js' | |
const SubjectBarsChart = ({data}) => ( | |
<Chart | |
data={data} | |
xAccesor={d => d.subject} | |
yAccesor={d => d.score} | |
xScale="band" | |
xScaleOptions={{ | |
padding: 0.2, | |
}} | |
yScale="linear" | |
yScaleOptions={{ | |
minRange: 0, | |
}} | |
> | |
<Background /> | |
<Axis variable="x" textAngle={-45}/> | |
<Axis variable="y" ticks={10} tickSize={5} /> | |
<Bars /> | |
</Chart> | |
) | |
SubjectBarsChart.propTypes = { | |
data: T.arrayOf(T.shape({ | |
subject: T.string.isRequired, | |
score: T.number.isRequired, | |
})) | |
} | |
export default SubjectBarsChart |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment