@@ -154,59 +154,60 @@ export default function TimeSeriesChart({
154154 const data = useMemo ( ( ) => rawData || [ ] , [ rawData ] )
155155
156156 return (
157- < ResponsiveContainer width = "100%" height = { 300 } >
158- < AreaChart
159- width = { width }
160- height = { height }
161- data = { data }
162- margin = { { top : 0 , right : 8 , bottom : 16 , left : 0 } }
163- className = { cn ( className , 'rounded-lg border border-default' ) }
164- >
165- < CartesianGrid stroke = { GRID_GRAY } vertical = { false } />
166- < XAxis
167- axisLine = { { stroke : GRID_GRAY } }
168- tickLine = { { stroke : GRID_GRAY } }
169- // TODO: show full given date range in the chart even if the data doesn't fill the range
170- domain = { [ 'auto' , 'auto' ] }
171- dataKey = "timestamp"
172- interval = "preserveStart"
173- scale = "time"
174- // TODO: use Date directly as x-axis values
175- type = "number"
176- name = "Time"
177- ticks = { getTicks ( data , 5 ) }
178- tickFormatter = { isSameDay ( startTime , endTime ) ? shortTime : shortDateTime }
179- tick = { textMonoMd }
180- tickMargin = { 8 }
181- />
182- < YAxis
183- axisLine = { { stroke : GRID_GRAY } }
184- tickLine = { { stroke : GRID_GRAY } }
185- orientation = "right"
186- tick = { textMonoMd }
187- tickMargin = { 8 }
188- tickFormatter = { yAxisTickFormatter }
189- padding = { { top : 32 } }
190- { ...yTicks }
191- />
192- { /* TODO: stop tooltip being focused by default on pageload if nothing else has been clicked */ }
193- < Tooltip
194- isAnimationActive = { false }
195- content = { ( props : TooltipProps < number , string > ) => renderTooltip ( props , unit ) }
196- cursor = { { stroke : CURSOR_GRAY , strokeDasharray : '3,3' } }
197- wrapperStyle = { { outline : 'none' } }
198- />
199- < Area
200- dataKey = "value"
201- name = { title }
202- type = { interpolation }
203- stroke = { GREEN_600 }
204- fill = { GREEN_400 }
205- isAnimationActive = { false }
206- dot = { false }
207- activeDot = { { fill : GREEN_800 , r : 3 , strokeWidth : 0 } }
208- />
209- </ AreaChart >
210- </ ResponsiveContainer >
157+ < div className = "h-[300px] w-full" >
158+ < ResponsiveContainer className = { cn ( className , 'rounded-lg border border-default' ) } >
159+ < AreaChart
160+ width = { width }
161+ height = { height }
162+ data = { data }
163+ margin = { { top : 0 , right : 8 , bottom : 16 , left : 0 } }
164+ >
165+ < CartesianGrid stroke = { GRID_GRAY } vertical = { false } />
166+ < XAxis
167+ axisLine = { { stroke : GRID_GRAY } }
168+ tickLine = { { stroke : GRID_GRAY } }
169+ // TODO: show full given date range in the chart even if the data doesn't fill the range
170+ domain = { [ 'auto' , 'auto' ] }
171+ dataKey = "timestamp"
172+ interval = "preserveStart"
173+ scale = "time"
174+ // TODO: use Date directly as x-axis values
175+ type = "number"
176+ name = "Time"
177+ ticks = { getTicks ( data , 5 ) }
178+ tickFormatter = { isSameDay ( startTime , endTime ) ? shortTime : shortDateTime }
179+ tick = { textMonoMd }
180+ tickMargin = { 8 }
181+ />
182+ < YAxis
183+ axisLine = { { stroke : GRID_GRAY } }
184+ tickLine = { { stroke : GRID_GRAY } }
185+ orientation = "right"
186+ tick = { textMonoMd }
187+ tickMargin = { 8 }
188+ tickFormatter = { yAxisTickFormatter }
189+ padding = { { top : 32 } }
190+ { ...yTicks }
191+ />
192+ { /* TODO: stop tooltip being focused by default on pageload if nothing else has been clicked */ }
193+ < Tooltip
194+ isAnimationActive = { false }
195+ content = { ( props : TooltipProps < number , string > ) => renderTooltip ( props , unit ) }
196+ cursor = { { stroke : CURSOR_GRAY , strokeDasharray : '3,3' } }
197+ wrapperStyle = { { outline : 'none' } }
198+ />
199+ < Area
200+ dataKey = "value"
201+ name = { title }
202+ type = { interpolation }
203+ stroke = { GREEN_600 }
204+ fill = { GREEN_400 }
205+ isAnimationActive = { false }
206+ dot = { false }
207+ activeDot = { { fill : GREEN_800 , r : 3 , strokeWidth : 0 } }
208+ />
209+ </ AreaChart >
210+ </ ResponsiveContainer >
211+ </ div >
211212 )
212213}
0 commit comments