File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -37,6 +37,11 @@ const getTicks = (
3737const timeDotLabel = ( { y } : Coordinate ) => timeHelpers . fromMinutes ( y )
3838const hourDotLabel = ( { y } : Coordinate ) => `${ ( y / 60 ) . toFixed ( 1 ) } h`
3939
40+ const getPadding = ( items : number ) : [ number , number ] => [
41+ 24 ,
42+ Math . max ( 1 , 6 - items ) * 24 ,
43+ ]
44+
4045interface TimeChartProps {
4146 timeStats : Record < string , TimeStats >
4247 tickLabel ?: ( x : number ) => string
@@ -60,7 +65,12 @@ export const WorkingHoursChart = ({
6065 const maxY = Math . max ( startRange . maxY , endRange . maxY )
6166
6267 return (
63- < Chart . Root maxX = { maxX } minY = { minY } maxY = { maxY } >
68+ < Chart . Root
69+ maxX = { maxX }
70+ minY = { minY }
71+ maxY = { maxY }
72+ padding = { getPadding ( startPoints . length ) }
73+ >
6474 < Chart . Caption > Working Hours (avg)</ Chart . Caption >
6575
6676 < Chart . Line points = { startPoints } />
@@ -85,7 +95,12 @@ export const TotalTimeChart = ({
8595 const { maxX, maxY } = getGraphRange ( points )
8696
8797 return (
88- < Chart . Root maxX = { maxX } minY = { 0 } maxY = { maxY } >
98+ < Chart . Root
99+ maxX = { maxX }
100+ minY = { 0 }
101+ maxY = { maxY }
102+ padding = { getPadding ( points . length ) }
103+ >
89104 < Chart . Caption > Working Time (avg)</ Chart . Caption >
90105 < Chart . Bars points = { points } printValue = { hourDotLabel } />
91106
You can’t perform that action at this time.
0 commit comments