Skip to content

Commit 7bf064d

Browse files
committed
remove width and height from TimeSeriesChart
1 parent a5804f8 commit 7bf064d

3 files changed

Lines changed: 5 additions & 17 deletions

File tree

app/components/SystemMetric.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,6 @@ export function SiloMetric({
103103
<TimeSeriesChart
104104
data={data}
105105
title={title}
106-
width={480}
107-
height={240}
108106
interpolation="stepAfter"
109107
startTime={startTime}
110108
endTime={endTime}
@@ -179,8 +177,6 @@ export function SystemMetric({
179177
<TimeSeriesChart
180178
data={data}
181179
title={title}
182-
width={480}
183-
height={240}
184180
interpolation="stepAfter"
185181
startTime={startTime}
186182
endTime={endTime}

app/components/TimeSeriesChart.tsx

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,6 @@ type TimeSeriesChartProps = {
110110
className?: string
111111
data: ChartDatum[] | undefined
112112
title: string
113-
width: number
114-
height: number
115113
interpolation?: 'linear' | 'stepAfter'
116114
startTime: Date
117115
endTime: Date
@@ -169,8 +167,6 @@ export function TimeSeriesChart({
169167
className,
170168
data: rawData,
171169
title,
172-
width,
173-
height,
174170
interpolation = 'linear',
175171
startTime,
176172
endTime,
@@ -228,16 +224,14 @@ export function TimeSeriesChart({
228224
)
229225
}
230226

227+
const margin = { top: 0, right: hasBorder ? 16 : 0, bottom: 0, left: 0 }
228+
229+
// ResponsiveContainer has default height and width of 100%
230+
// https://recharts.org/en-US/api/ResponsiveContainer
231231
return (
232232
<div className="h-[300px] w-full">
233-
{/* temporary until we migrate the old metrics to the new style */}
234233
<ResponsiveContainer className={wrapperClass}>
235-
<AreaChart
236-
width={width}
237-
height={height}
238-
data={data}
239-
margin={{ top: 0, right: hasBorder ? 16 : 0, bottom: 0, left: 0 }}
240-
>
234+
<AreaChart data={data} margin={margin}>
241235
<CartesianGrid stroke={GRID_GRAY} vertical={false} />
242236
<XAxis
243237
axisLine={{ stroke: GRID_GRAY }}

app/components/oxql-metrics/OxqlMetric.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,6 @@ export function OxqlMetric({ title, description, unit, ...queryObj }: OxqlMetric
111111
unit={unitForSet}
112112
data={data}
113113
yAxisTickFormatter={yAxisTickFormatter}
114-
width={480}
115-
height={240}
116114
hasBorder={false}
117115
hasError={!!error}
118116
/>

0 commit comments

Comments
 (0)