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 b6b23fc701..07f18c3d5e 100644 --- a/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/transformProps.ts +++ b/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/transformProps.ts @@ -41,6 +41,7 @@ import { EchartsTimeseriesSeriesType, TimeseriesChartTransformedProps, OrientationType, + AxisType, } from './types'; import { DEFAULT_FORM_DATA } from './constants'; import { ForecastSeriesEnum, ForecastValue } from '../types'; @@ -337,13 +338,23 @@ export default function transformProps( rotate: xAxisLabelRotation, }, minInterval: - xAxisType === 'time' && timeGrainSqla + xAxisType === AxisType.time && timeGrainSqla ? TIMEGRAIN_TO_TIMESTAMP[timeGrainSqla] : 0, }; + + if (xAxisType === AxisType.time) { + /** + * Overriding default behavior (false) for time axis regardless of the granilarity. + * Not including this in the initial declaration above so if echarts changes the default + * behavior for other axist types we won't unintentionally override it + */ + xAxis.axisLabel.showMaxLabel = null; + } + let yAxis: any = { ...defaultYAxis, - type: logAxis ? 'log' : 'value', + type: logAxis ? AxisType.log : AxisType.value, min, max, minorTick: { show: true }, diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/types.ts b/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/types.ts index 946d41ec16..71729bd0f1 100644 --- a/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/types.ts +++ b/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/types.ts @@ -94,3 +94,10 @@ export interface EchartsTimeseriesChartProps export type TimeseriesChartTransformedProps = EChartTransformedProps; + +export enum AxisType { + category = 'category', + value = 'value', + time = 'time', + log = 'log', +}