fix(mixed-timeseries): apply same axis formatting options as timeseries charts (#38979)

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Michael S. Molina
2026-03-31 15:00:46 -03:00
committed by GitHub
parent d4d22909cb
commit 8559786cc2

View File

@@ -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: