-
Notifications
You must be signed in to change notification settings - Fork 0
/
time_series_viz.js
52 lines (47 loc) · 1.03 KB
/
time_series_viz.js
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
42
43
44
45
46
47
48
49
50
51
52
/**
*
*/
import React, { Component } from 'react';
import {
Line,
XAxis,
YAxis,
Tooltip,
LineChart,
CartesianGrid,
ResponsiveContainer,
} from 'recharts';
export default class TimeSeriesViz extends Component {
constructor(props) {
super(props);
this.state = {
data: [
{ month: 'Jan', reports: 5 },
{ month: 'Feb', reports: 10 },
{ month: 'Mar', reports: 15 },
{ month: 'Apr', reports: 3 },
{ month: 'May', reports: 4 },
{ month: 'Jun', reports: 1 },
],
}
}
render() {
const { data } = this.props;
return (
<div>
<div>
<h3>Report Trend - Last 6 Months</h3>
</div>
<ResponsiveContainer width="100%" height={400}>
<LineChart data={data}>
<CartesianGrid />
<XAxis dataKey="month" />
<YAxis />
<Tooltip />
<Line type="monotone" dataKey="reports" stroke="#F85032" />
</LineChart>
</ResponsiveContainer>
</div>
);
}
}