This is an automated email from the ASF dual-hosted git repository.
enzomartellucci pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/superset.git
The following commit(s) were added to refs/heads/master by this push:
new f4597be341 fix(timeseries): x-axis last month was hidden (#37181)
f4597be341 is described below
commit f4597be341c3cc982a4c4639800c906be4ec39ba
Author: Luis Sánchez <[email protected]>
AuthorDate: Mon Jan 19 13:19:34 2026 -0300
fix(timeseries): x-axis last month was hidden (#37181)
---
.../src/Timeseries/transformProps.ts | 4 ++
.../test/Timeseries/transformers.test.ts | 49 +++++++++++++++++++++-
2 files changed, 52 insertions(+), 1 deletion(-)
diff --git
a/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/transformProps.ts
b/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/transformProps.ts
index fe37eea027..6058a94800 100644
---
a/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/transformProps.ts
+++
b/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/transformProps.ts
@@ -551,6 +551,10 @@ export default function transformProps(
formatter: xAxisFormatter,
rotate: xAxisLabelRotation,
interval: xAxisLabelInterval,
+ ...(xAxisType === AxisType.Time && {
+ showMaxLabel: true,
+ alignMaxLabel: 'right',
+ }),
},
minorTick: { show: minorTicks },
minInterval:
diff --git
a/superset-frontend/plugins/plugin-chart-echarts/test/Timeseries/transformers.test.ts
b/superset-frontend/plugins/plugin-chart-echarts/test/Timeseries/transformers.test.ts
index 954221d56c..143bdf4389 100644
---
a/superset-frontend/plugins/plugin-chart-echarts/test/Timeseries/transformers.test.ts
+++
b/superset-frontend/plugins/plugin-chart-echarts/test/Timeseries/transformers.test.ts
@@ -16,13 +16,17 @@
* specific language governing permissions and limitations
* under the License.
*/
-import { CategoricalColorScale } from '@superset-ui/core';
+import { CategoricalColorScale, ChartProps } from '@superset-ui/core';
+import { GenericDataType } from '@apache-superset/core/api/core';
+import { supersetTheme } from '@apache-superset/core/ui';
import type { SeriesOption } from 'echarts';
import { EchartsTimeseriesSeriesType } from '../../src';
import {
transformSeries,
transformNegativeLabelsPosition,
} from '../../src/Timeseries/transformers';
+import transformProps from '../../src/Timeseries/transformProps';
+import { EchartsTimeseriesChartProps } from '../../src/types';
// Mock the colorScale function
const mockColorScale = jest.fn(
@@ -190,3 +194,46 @@ describe('transformNegativeLabelsPosition', () => {
expect((result as any)[4].label).toBe(undefined);
});
});
+
+test('should configure time axis labels to show max label for last month
visibility', () => {
+ const formData = {
+ colorScheme: 'bnbColors',
+ datasource: '3__table',
+ granularity_sqla: 'ds',
+ metric: 'sum__num',
+ viz_type: 'my_viz',
+ };
+ const queriesData = [
+ {
+ data: [
+ { sum__num: 100, __timestamp: new Date('2026-01-01').getTime() },
+ { sum__num: 200, __timestamp: new Date('2026-02-01').getTime() },
+ { sum__num: 300, __timestamp: new Date('2026-03-01').getTime() },
+ { sum__num: 400, __timestamp: new Date('2026-04-01').getTime() },
+ { sum__num: 500, __timestamp: new Date('2026-05-01').getTime() },
+ ],
+ colnames: ['sum__num', '__timestamp'],
+ coltypes: [GenericDataType.Numeric, GenericDataType.Temporal],
+ },
+ ];
+ const chartProps = new ChartProps({
+ formData,
+ width: 800,
+ height: 600,
+ queriesData,
+ theme: supersetTheme,
+ });
+
+ const result = transformProps(
+ chartProps as unknown as EchartsTimeseriesChartProps,
+ );
+
+ expect(result.echartOptions.xAxis).toEqual(
+ expect.objectContaining({
+ axisLabel: expect.objectContaining({
+ showMaxLabel: true,
+ alignMaxLabel: 'right',
+ }),
+ }),
+ );
+});