|
1 |
| -import React from 'react'; |
| 1 | +import { bindActionCreators } from "redux"; |
2 | 2 | import { connect } from "react-redux";
|
| 3 | +import ReactFlot from "react-flot"; |
3 | 4 | import { setDateRange, receiveJSON } from "../redux/actions";
|
4 | 5 | import "react-dom";
|
5 | 6 |
|
6 |
| -import ReactFlot from 'react-flot'; |
7 |
| -import 'react-flot/flot/jquery.flot.time.min'; |
8 |
| -import 'react-flot/flot/jquery.flot.selection.min'; |
9 |
| -import { bindActionCreators } from "redux"; |
| 7 | +import "react-flot/flot/jquery.flot.time.min"; |
| 8 | +import "react-flot/flot/jquery.flot.selection.min"; |
10 | 9 |
|
11 |
| -let currentJSONController = null; |
12 | 10 | class TimelineChart extends ReactFlot {
|
13 |
| - constructor(props) { |
14 |
| - super(props); |
15 |
| - } |
16 |
| - |
17 | 11 | componentDidMount() {
|
18 | 12 | this.draw();
|
19 |
| - $(`#${this.props.id}`).bind('plotselected', (event, ranges) => { |
20 |
| - this.props.actions.setDateRange(Math.round(ranges.xaxis.from / 1000), Math.round(ranges.xaxis.to / 1000)); |
| 13 | + $(`#${this.props.id}`).bind("plotselected", (event, ranges) => { |
| 14 | + this.props.actions.setDateRange( |
| 15 | + Math.round(ranges.xaxis.from / 1000), |
| 16 | + Math.round(ranges.xaxis.to / 1000) |
| 17 | + ); |
21 | 18 | });
|
22 | 19 | }
|
23 | 20 | }
|
24 | 21 |
|
25 |
| -const mapStateToProps = state => ({ |
| 22 | +const mapStateToProps = (state) => ({ |
26 | 23 | ...state,
|
27 | 24 | });
|
28 | 25 |
|
29 |
| -const mapDispatchToProps = dispatch => ({ |
| 26 | +const mapDispatchToProps = (dispatch) => ({ |
30 | 27 | actions: bindActionCreators(
|
31 | 28 | {
|
32 | 29 | setDateRange,
|
33 | 30 | receiveJSON,
|
34 | 31 | },
|
35 |
| - dispatch, |
| 32 | + dispatch |
36 | 33 | ),
|
37 | 34 | });
|
38 | 35 |
|
39 |
| -export default connect( |
40 |
| - mapStateToProps, |
41 |
| - mapDispatchToProps, |
42 |
| -)(TimelineChart); |
| 36 | +export default connect(mapStateToProps, mapDispatchToProps)(TimelineChart); |
0 commit comments