1
1
import React , { Component } from "react" ;
2
- import {
3
- BarChart ,
4
- Bar ,
5
- XAxis ,
6
- YAxis ,
7
- Tooltip ,
8
- ResponsiveContainer ,
9
- } from "recharts" ;
10
- import { withStyles } from "@material-ui/styles" ;
11
- import styles from "../styles/BarchartStyles" ;
2
+ import { BarChart , Bar , XAxis , YAxis , Tooltip } from "recharts" ;
12
3
13
- class Barchart extends Component {
4
+ export default class Barchart extends Component {
14
5
render ( ) {
15
- const { data, isLoading, dataKey, stroke, classes } = this . props ;
6
+ const { data, isLoading, dataKey, stroke } = this . props ;
16
7
let result ;
17
8
try {
18
9
const updatedData = data . slice ( 1 ) . slice ( - 50 ) ;
@@ -35,25 +26,21 @@ class Barchart extends Component {
35
26
} catch ( err ) { }
36
27
37
28
return (
38
- < div className = { classes . barcharts } >
39
- < ResponsiveContainer >
40
- { ! isLoading && (
41
- < BarChart
42
- width = { 350 }
43
- height = { 150 }
44
- data = { result }
45
- margin = { { top : 5 , right : 30 , left : 20 , bottom : 5 } }
46
- >
47
- < XAxis dataKey = "date" />
48
- < YAxis />
49
- < Tooltip />
50
- < Bar dataKey = { dataKey } fill = { stroke } />
51
- </ BarChart >
52
- ) }
53
- </ ResponsiveContainer >
29
+ < div className = "barcharts" >
30
+ { ! isLoading && (
31
+ < BarChart
32
+ width = { 350 }
33
+ height = { 150 }
34
+ data = { result }
35
+ margin = { { top : 5 , right : 30 , left : 20 , bottom : 5 } }
36
+ >
37
+ < XAxis dataKey = "date" />
38
+ < YAxis />
39
+ < Tooltip />
40
+ < Bar dataKey = { dataKey } fill = { stroke } />
41
+ </ BarChart >
42
+ ) }
54
43
</ div >
55
44
) ;
56
45
}
57
46
}
58
-
59
- export default withStyles ( styles ) ( Barchart ) ;
0 commit comments