forked from ankane/react-chartkick
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.html
More file actions
41 lines (37 loc) · 1.3 KB
/
test.html
File metadata and controls
41 lines (37 loc) · 1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>React Chartkick</title>
<script crossorigin src="https://unpkg.com/react@16/umd/react.development.js"></script>
<script crossorigin src="https://unpkg.com/react-dom@16/umd/react-dom.development.js"></script>
<script src="https://unpkg.com/babel-standalone@6.15.0/babel.min.js"></script>
<script src="https://unpkg.com/chart.js@2.7.1/dist/Chart.bundle.js"></script>
<script src="https://unpkg.com/chartkick@2.2.3"></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 (
<div>
<LineChart data={this.state.data} download={true} />
<PieChart data={this.state.data} />
</div>
)
}
}
ReactDOM.render(<App />, document.getElementById("root"))
</script>
</body>
</html>