diff --git a/src/components/Barchart.js b/src/components/Barchart.js index edc4d78..ce7d797 100644 --- a/src/components/Barchart.js +++ b/src/components/Barchart.js @@ -1,9 +1,18 @@ import React, { Component } from "react"; -import { BarChart, Bar, XAxis, YAxis, Tooltip } from "recharts"; +import { + BarChart, + Bar, + XAxis, + YAxis, + Tooltip, + ResponsiveContainer, +} from "recharts"; +import { withStyles } from "@material-ui/styles"; +import styles from "../styles/BarchartStyles"; -export default class Barchart extends Component { +class Barchart extends Component { render() { - const { data, isLoading, dataKey, stroke } = this.props; + const { data, isLoading, dataKey, stroke, classes } = this.props; let result; try { const updatedData = data.slice(1).slice(-50); @@ -26,21 +35,25 @@ export default class Barchart extends Component { } catch (err) {} return ( -
- {!isLoading && ( - - - - - - - )} +
+ + {!isLoading && ( + + + + + + + )} +
); } } + +export default withStyles(styles)(Barchart); diff --git a/src/styles/BarchartStyles.js b/src/styles/BarchartStyles.js new file mode 100644 index 0000000..dea98a7 --- /dev/null +++ b/src/styles/BarchartStyles.js @@ -0,0 +1,6 @@ +export default { + barcharts: { + width: "100%", + height: "17rem", + }, +};