11import 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" ;
123
13- class Barchart extends Component {
4+ export default class Barchart extends Component {
145 render ( ) {
15- const { data, isLoading, dataKey, stroke, classes } = this . props ;
6+ const { data, isLoading, dataKey, stroke } = this . props ;
167 let result ;
178 try {
189 const updatedData = data . slice ( 1 ) . slice ( - 50 ) ;
@@ -35,25 +26,21 @@ class Barchart extends Component {
3526 } catch ( err ) { }
3627
3728 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+ ) }
5443 </ div >
5544 ) ;
5645 }
5746}
58-
59- export default withStyles ( styles ) ( Barchart ) ;
0 commit comments