diff --git a/README.md b/README.md index d08113f..4748978 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,8 @@ npm install react-svg-chart ## Usage +### Bar chart + ```js import React from 'react'; import { BarChart } from 'react-svg-chart'; @@ -28,3 +30,26 @@ const App = () => ( /> ); ``` + +### Line chart + +```js +import React from 'react'; +import { LineChart } from 'react-svg-chart'; + +const App = () => ( + +); +``` diff --git a/examples/lineChart/.gitignore b/examples/lineChart/.gitignore new file mode 100644 index 0000000..8c7d1b8 --- /dev/null +++ b/examples/lineChart/.gitignore @@ -0,0 +1,2 @@ +client.dist.js +node_modules/ diff --git a/examples/lineChart/App.js b/examples/lineChart/App.js new file mode 100644 index 0000000..88f8934 --- /dev/null +++ b/examples/lineChart/App.js @@ -0,0 +1,80 @@ +import React, { createClass } from 'react'; +import { LineChart } from '../../src'; + +const days = [ + { + title: 'Thursday, 9th March', + lines: [ + { + points: [ + { value: 3.50 }, + { value: 7.45 }, + { value: 1.27 }, + { value: 1.15 }, + { value: 2.93 }, + ], + }, + ], + }, + { + title: 'Wednesday, 8th March', + lines: [ + { + points: [ + { value: 1.92 }, + { value: 1.11 }, + { value: 7.20 }, + { value: 6.34 }, + { value: 3.15 }, + ], + }, + ], + }, + { + title: 'Tuesday, 7th March', + lines: [ + { + points: [ + { value: 5.37 }, + { value: 7.32 }, + { value: 0.90 }, + { value: 4.78 }, + { value: 2.75 }, + ], + }, + ], + }, +]; + +const App = createClass({ + onChange ( e ) { + this.setState({ + day: days[ e.target.value ], + }); + }, + + getInitialState () { + return { + day: days[ 0 ], + }; + }, + + render () { + return ( +
+ + +
+ ); + } +}); + +export default App; diff --git a/examples/lineChart/Page.js b/examples/lineChart/Page.js new file mode 100644 index 0000000..6c22910 --- /dev/null +++ b/examples/lineChart/Page.js @@ -0,0 +1,47 @@ +import React, { PropTypes } from 'react'; + +const propTypes = { + app: PropTypes.string.isRequired, +}; + +const Page = ({ app }) => ( + + + + + +
+