Skip to content

Commit f760181

Browse files
committed
Make chart dimensions dynamic
1 parent 27fca94 commit f760181

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/components/Dashboard/Chart/CandleSticks.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ import { timeIntervalBarWidth } from "react-stockcharts/lib/utils";
99

1010
let CandleSticks = (props) => {
1111
const data = props.data;
12+
const vh = Math.max(document.documentElement.clientHeight || 0, window.innerHeight || 0)
13+
const vw = Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0)
1214

1315
const xAccessor = (d) => {
1416
return d.date;
@@ -17,9 +19,9 @@ let CandleSticks = (props) => {
1719
return (
1820
<div className="CandleSticks">
1921
<ChartCanvas
20-
height={800}
22+
height={vh - 120}
2123
ratio={1}
22-
width={1600}
24+
width={vw - 300}
2325
margin={{ left: 50, right: 50, top: 10, bottom: 30 }}
2426
type={"svg"}
2527
data={data}

0 commit comments

Comments
 (0)