File tree Expand file tree Collapse file tree 3 files changed +31
-13
lines changed
components/common/ui/charts Expand file tree Collapse file tree 3 files changed +31
-13
lines changed Original file line number Diff line number Diff line change @@ -23,14 +23,18 @@ ChartJS.register(
2323function BarChart ( {
2424 options,
2525 data,
26- width = 300 ,
27- height = 300
26+ width,
27+ height
2828} ) {
29+ const container = ( ! width || ! height )
30+ ? { width : '100vw' , height : '100vh' }
31+ : { }
32+
2933 return (
30- < FullBox >
34+ < FullBox sx = { container } >
3135 < Bar
32- width = { width }
33- height = { height }
36+ width = { width ?? 300 }
37+ height = { height ?? 300 }
3438 options = { options }
3539 data = { data }
3640 />
@@ -39,9 +43,11 @@ function BarChart ({
3943}
4044
4145BarChart . propTypes = {
42- data : PropTypes . array ,
46+ data : PropTypes . object ,
4347 options : PropTypes . object ,
48+ /** Graph width in pixels. Will occupy full screen width if ommitted */
4449 width : PropTypes . number ,
50+ /** Graph height in pixels. Will occupy full screen height if ommitted */
4551 height : PropTypes . number
4652}
4753
Original file line number Diff line number Diff line change @@ -5,8 +5,12 @@ import FullBox from '@/components/common/layout/fullbox'
55ChartJS . register ( ArcElement , Tooltip , Legend )
66
77function DonutChart ( props ) {
8+ const container = ( ! props . width || ! props . height )
9+ ? { width : '100vw' , height : '100vh' }
10+ : { }
11+
812 return (
9- < FullBox >
13+ < FullBox sx = { container } >
1014 < Doughnut
1115 data = { props }
1216 width = { props ?. width || 300 }
@@ -19,7 +23,9 @@ function DonutChart (props) {
1923
2024DonutChart . propTypes = {
2125 data : PropTypes . array ,
26+ /** Graph width in pixels. Will occupy full screen width if ommitted */
2227 width : PropTypes . number ,
28+ /** Graph height in pixels. Will occupy full screen height if ommitted */
2329 height : PropTypes . number
2430}
2531
Original file line number Diff line number Diff line change @@ -25,25 +25,31 @@ import FullBox from '@/components/common/layout/fullbox'
2525function LineGraph ( {
2626 options,
2727 data,
28- width = 300 ,
29- height = 300
28+ width,
29+ height
3030} ) {
31+ const container = ( ! width || ! height )
32+ ? { width : '100vw' , height : '100vh' }
33+ : { }
34+
3135 return (
32- < FullBox >
36+ < FullBox sx = { container } >
3337 < Line
34- width = { width }
35- height = { height }
3638 options = { options }
3739 data = { data }
40+ width = { width ?? 300 }
41+ height = { height ?? 300 }
3842 />
3943 </ FullBox >
4044 )
4145}
4246
4347LineGraph . propTypes = {
44- data : PropTypes . array ,
48+ data : PropTypes . object ,
4549 options : PropTypes . object ,
50+ /** Graph width in pixels. Will occupy full screen width if ommitted */
4651 width : PropTypes . number ,
52+ /** Graph height in pixels. Will occupy full screen height if ommitted */
4753 height : PropTypes . number
4854}
4955
You can’t perform that action at this time.
0 commit comments