From 8559786cc2994d731300e5e53c58e2246adfac72 Mon Sep 17 00:00:00 2001 From: "Michael S. Molina" <70410625+michael-s-molina@users.noreply.github.com> Date: Tue, 31 Mar 2026 15:00:46 -0300 Subject: [PATCH] fix(mixed-timeseries): apply same axis formatting options as timeseries charts (#38979) Co-authored-by: Claude Opus 4.6 --- .../src/MixedTimeseries/transformProps.ts | 31 +++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/MixedTimeseries/transformProps.ts b/superset-frontend/plugins/plugin-chart-echarts/src/MixedTimeseries/transformProps.ts index b1655e38d1d..71dc91183a9 100644 --- a/superset-frontend/plugins/plugin-chart-echarts/src/MixedTimeseries/transformProps.ts +++ b/superset-frontend/plugins/plugin-chart-echarts/src/MixedTimeseries/transformProps.ts @@ -578,9 +578,31 @@ export default function transformProps( : String; const xAxisFormatter = xAxisDataType === GenericDataType.Temporal - ? getXAxisFormatter(xAxisTimeFormat) + ? getXAxisFormatter(xAxisTimeFormat, timeGrainSqla) : String; + const showMaxLabel = xAxisType === AxisType.Time && xAxisLabelRotation === 0; + const deduplicatedFormatter = showMaxLabel + ? (() => { + let lastLabel: string | undefined; + const wrapper = (value: number | string) => { + const label = + typeof xAxisFormatter === 'function' + ? (xAxisFormatter as Function)(value) + : String(value); + if (label === lastLabel) { + return ''; + } + lastLabel = label; + return label; + }; + if (typeof xAxisFormatter === 'function' && 'id' in xAxisFormatter) { + (wrapper as any).id = (xAxisFormatter as any).id; + } + return wrapper; + })() + : xAxisFormatter; + const addYAxisTitleOffset = !!(yAxisTitle || yAxisTitleSecondary) && convertInteger(yAxisTitleMargin) !== 0; @@ -658,9 +680,14 @@ export default function transformProps( nameGap: convertInteger(xAxisTitleMargin), nameLocation: 'middle', axisLabel: { - formatter: xAxisFormatter, + hideOverlap: !(xAxisType === AxisType.Time && xAxisLabelRotation !== 0), + formatter: deduplicatedFormatter, rotate: xAxisLabelRotation, interval: xAxisLabelInterval, + ...(showMaxLabel && { + showMaxLabel: true, + alignMaxLabel: 'right', + }), }, minorTick: { show: minorTicks }, minInterval: