Permalink
Find file
Fetching contributors…
Cannot retrieve contributors at this time
39 lines (34 sloc) 1.16 KB
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>React Chartkick</title>
<script src="https://fb.me/react-15.0.1.js"></script>
<script src="https://fb.me/react-dom-15.0.1.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.8.23/browser.min.js"></script>
<script src="https://unpkg.com/chart.js@2.4.0/dist/Chart.bundle.js"></script>
<script src="https://unpkg.com/chartkick@2.2.1"></script>
<script src="dist/react-chartkick.js"></script>
</head>
<body>
<div id="root"></div>
<script type="text/babel">
class App extends React.Component {
constructor() {
super()
this.state = {data: [["Jan", 4], ["Feb", 2], ["Mar", 10], ["Apr", 5], ["May", 3], ["Jun", 8], ["Jul", 4]]}
}
componentDidMount() {
const boom = () => this.setState({data: [...this.state.data, ["Aug", 10]]})
setTimeout(boom, 1000)
}
render() {
return (
<LineChart data={this.state.data} download={true} />
)
}
}
ReactDOM.render(<App />, document.getElementById("root"))
</script>
</body>
</html>