mirror of
https://github.com/apache/superset.git
synced 2026-05-07 08:54:23 +00:00
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:
committed by
GitHub
parent
d4d22909cb
commit
8559786cc2
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user