mirror of
https://github.com/apache/superset.git
synced 2026-08-05 13:32:41 +00:00
fix(explore): show the beginning date on time-series x-axis line charts (#42046)
This commit is contained in:
@@ -641,7 +641,22 @@ export default function transformProps(
|
||||
const deduplicatedFormatter = showMaxLabel
|
||||
? (() => {
|
||||
let lastLabel: string | undefined;
|
||||
let lastValue: number | undefined;
|
||||
const wrapper = (value: number | string) => {
|
||||
// ECharts formats the labels in repeated ascending passes. Reset the
|
||||
// dedup state when the sequence restarts so a forced boundary label
|
||||
// (e.g. the min date) isn't blanked by the previous pass's last label
|
||||
// when both format identically (e.g. a May-to-May range).
|
||||
if (
|
||||
typeof value === 'number' &&
|
||||
lastValue !== undefined &&
|
||||
value <= lastValue
|
||||
) {
|
||||
lastLabel = undefined;
|
||||
}
|
||||
if (typeof value === 'number') {
|
||||
lastValue = value;
|
||||
}
|
||||
const label =
|
||||
typeof xAxisFormatter === 'function'
|
||||
? (xAxisFormatter as Function)(value)
|
||||
@@ -743,6 +758,8 @@ export default function transformProps(
|
||||
...(showMaxLabel && {
|
||||
showMaxLabel: true,
|
||||
alignMaxLabel: 'right',
|
||||
showMinLabel: true,
|
||||
alignMinLabel: 'left',
|
||||
}),
|
||||
},
|
||||
minorTick: { show: minorTicks },
|
||||
|
||||
Reference in New Issue
Block a user