Skip to content

Commit 768c2bb

Browse files
fix: Enhance chart container and axis properties for better responsiveness
1 parent 128edd3 commit 768c2bb

File tree

2 files changed

+34
-6
lines changed

2 files changed

+34
-6
lines changed

dashboard/src/components/charts/AllNodesStackedBarChart.tsx

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -493,12 +493,31 @@ export function AllNodesStackedBarChart() {
493493
className="max-h-[400px] min-h-[200px]"
494494
/>
495495
) : (
496-
<ChartContainer dir={'ltr'} config={chartContainerConfig} className="max-h-[400px] min-h-[200px] w-full">
496+
<ChartContainer
497+
dir={'ltr'}
498+
config={chartContainerConfig}
499+
className="max-h-[400px] min-h-[200px] w-full overflow-x-auto"
500+
>
497501
{chartData && chartData.length > 0 ? (
498-
<BarChart accessibilityLayer data={chartData}>
502+
<BarChart
503+
accessibilityLayer
504+
data={chartData}
505+
margin={{ top: 5, right: 10, left: 10, bottom: 5 }}
506+
>
499507
<CartesianGrid direction={'ltr'} vertical={false} />
500-
<XAxis direction={'ltr'} dataKey="time" tickLine={false} tickMargin={10} axisLine={false} />
501-
<YAxis direction={'ltr'} tickLine={false} axisLine={false} tickFormatter={value => `${value.toFixed(2)} GB`}
508+
<XAxis
509+
direction={'ltr'}
510+
dataKey="time"
511+
tickLine={false}
512+
tickMargin={10}
513+
axisLine={false}
514+
minTickGap={5}
515+
/>
516+
<YAxis
517+
direction={'ltr'}
518+
tickLine={false}
519+
axisLine={false}
520+
tickFormatter={value => `${value.toFixed(2)} GB`}
502521
tick={{
503522
fill: 'hsl(var(--muted-foreground))',
504523
fontSize: 9,

dashboard/src/components/charts/CostumeBarChart.tsx

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,9 +282,17 @@ export function CostumeBarChart({ nodeId }: CostumeBarChartProps) {
282282
className="max-h-[300px] sm:max-h-[400px] min-h-[150px] sm:min-h-[200px]"
283283
/>
284284
) : (
285-
<ChartContainer dir={'ltr'} config={chartConfig} className="max-h-[300px] sm:max-h-[400px] min-h-[150px] sm:min-h-[200px] w-full">
285+
<ChartContainer
286+
dir={'ltr'}
287+
config={chartConfig}
288+
className="max-h-[300px] sm:max-h-[400px] min-h-[150px] sm:min-h-[200px] w-full overflow-x-auto"
289+
>
286290
{chartData && chartData.length > 0 ? (
287-
<BarChart accessibilityLayer data={chartData}>
291+
<BarChart
292+
accessibilityLayer
293+
data={chartData}
294+
margin={{ top: 5, right: 10, left: 10, bottom: 5 }}
295+
>
288296
<CartesianGrid direction={'ltr'} vertical={false} />
289297
<XAxis
290298
direction={'ltr'}
@@ -297,6 +305,7 @@ export function CostumeBarChart({ nodeId }: CostumeBarChartProps) {
297305
fontSize: 8,
298306
fontWeight: 500,
299307
}}
308+
minTickGap={5}
300309
/>
301310
<YAxis
302311
direction={'ltr'}

0 commit comments

Comments
 (0)