diff --git a/frontend/src/components/widgets/ChartWidget.tsx b/frontend/src/components/widgets/ChartWidget.tsx
index 8978675..b849eb0 100644
--- a/frontend/src/components/widgets/ChartWidget.tsx
+++ b/frontend/src/components/widgets/ChartWidget.tsx
@@ -18,6 +18,8 @@ import { RowHeightContext } from "../../themes/RowContext";
const DEFAULT_CHART_HEIGHT = 240;
// Approx pixels consumed by the widget frame's title/padding above the chart.
const FRAME_OVERHEAD = 60;
+// Keep auto-sized value axes from consuming the plot on narrow or dual-axis charts.
+const MAX_Y_AXIS_TICK_WIDTH = 96;
// CI / annotation helpers (mirror the cloud ApexCharts renderer) ───────────
const CI_BAND_OPACITY = 0.18;
@@ -1157,6 +1159,14 @@ function ChartBody({ widget, data, titleOffset = 0 }: Props & { titleOffset?: nu
axisLine: false,
tickLine: false,
};
+ // Formatted values can be wider than Recharts' fixed 60px default. Measure
+ // Y axes from their rendered ticks so leading characters stay visible, but
+ // truncate exceptionally long labels before they consume the plot area.
+ const autoWidthYAxisProps = {
+ ...commonAxisProps,
+ tick: { ...commonAxisProps.tick, width: MAX_Y_AXIS_TICK_WIDTH, maxLines: 1, breakAll: true },
+ width: "auto" as const,
+ };
const y2Tick = buildAxisFormatter(widget.y2, formatYTick);
const y2TooltipValue = buildAxisFormatter(widget.y2, formatTooltipValue);
@@ -1171,7 +1181,7 @@ function ChartBody({ widget, data, titleOffset = 0 }: Props & { titleOffset?: nu
) : null;
- const cartesianMargin = { top: 4, right: hasDual ? 12 : 8, bottom: 4, left: -4 };
+ const cartesianMargin = { top: 4, right: hasDual ? 12 : 8, bottom: 4, left: 4 };
const gridProps = { vertical: false, stroke: gridColor, strokeOpacity: 0.5, strokeDasharray: "3 3" };
const cartesianTooltip = ;
@@ -1212,7 +1222,7 @@ function ChartBody({ widget, data, titleOffset = 0 }: Props & { titleOffset?: nu
-
+
{rightYAxis}
{series.length > 1 && }
@@ -1276,12 +1286,12 @@ function ChartBody({ widget, data, titleOffset = 0 }: Props & { titleOffset?: nu
{horizontal ? (
<>
-
+
>
) : (
<>
-
+
{rightYAxis}
>
)}
@@ -1332,7 +1342,7 @@ function ChartBody({ widget, data, titleOffset = 0 }: Props & { titleOffset?: nu
-
+
{rightYAxis}
{series.length > 1 && }
@@ -1405,7 +1415,8 @@ function ChartBody({ widget, data, titleOffset = 0 }: Props & { titleOffset?: nu
-
@@ -1428,7 +1439,8 @@ function ChartBody({ widget, data, titleOffset = 0 }: Props & { titleOffset?: nu
-
@@ -1446,7 +1458,7 @@ function ChartBody({ widget, data, titleOffset = 0 }: Props & { titleOffset?: nu
-
+
{rightYAxis}
@@ -1486,7 +1498,7 @@ function ChartBody({ widget, data, titleOffset = 0 }: Props & { titleOffset?: nu
-
+
} />
@@ -1502,7 +1514,7 @@ function ChartBody({ widget, data, titleOffset = 0 }: Props & { titleOffset?: nu
-
+
} />
{/* Invisible base to offset */}
@@ -1603,7 +1615,7 @@ function ChartBody({ widget, data, titleOffset = 0 }: Props & { titleOffset?: nu
-
+
@@ -1623,7 +1635,7 @@ function ChartBody({ widget, data, titleOffset = 0 }: Props & { titleOffset?: nu
-
+
{typeof widget.yMin === "string" && (
@@ -1789,15 +1801,15 @@ function ChartBody({ widget, data, titleOffset = 0 }: Props & { titleOffset?: nu
<>
{multi
- ?
- : }
+ ?
+ : }
>
) : (
<>
{multi
?
: }
-
+
>
)}