mirror of
https://github.com/apache/superset.git
synced 2024-09-12 00:29:39 -04:00
fix(chart): Time Series set showMaxLabel as null for time xAxis (#20627)
* Time Series Chart: -Apache echarts has this option as false by default for time axis, so we need to override it for our charts so it's uto determined and not fixed to hidden. - Add AxisType enum so we stop comparing agains raw strings when checking xAxis type * Time Series Chart: - set the showMaxLabel option directly without using merge * Time Series Chart: - Rename the property to showMaxLabel as it was originally
This commit is contained in:
parent
e2206a7151
commit
9362e27ce2
@ -41,6 +41,7 @@ import {
|
|||||||
EchartsTimeseriesSeriesType,
|
EchartsTimeseriesSeriesType,
|
||||||
TimeseriesChartTransformedProps,
|
TimeseriesChartTransformedProps,
|
||||||
OrientationType,
|
OrientationType,
|
||||||
|
AxisType,
|
||||||
} from './types';
|
} from './types';
|
||||||
import { DEFAULT_FORM_DATA } from './constants';
|
import { DEFAULT_FORM_DATA } from './constants';
|
||||||
import { ForecastSeriesEnum, ForecastValue } from '../types';
|
import { ForecastSeriesEnum, ForecastValue } from '../types';
|
||||||
@ -337,13 +338,23 @@ export default function transformProps(
|
|||||||
rotate: xAxisLabelRotation,
|
rotate: xAxisLabelRotation,
|
||||||
},
|
},
|
||||||
minInterval:
|
minInterval:
|
||||||
xAxisType === 'time' && timeGrainSqla
|
xAxisType === AxisType.time && timeGrainSqla
|
||||||
? TIMEGRAIN_TO_TIMESTAMP[timeGrainSqla]
|
? TIMEGRAIN_TO_TIMESTAMP[timeGrainSqla]
|
||||||
: 0,
|
: 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 = {
|
let yAxis: any = {
|
||||||
...defaultYAxis,
|
...defaultYAxis,
|
||||||
type: logAxis ? 'log' : 'value',
|
type: logAxis ? AxisType.log : AxisType.value,
|
||||||
min,
|
min,
|
||||||
max,
|
max,
|
||||||
minorTick: { show: true },
|
minorTick: { show: true },
|
||||||
|
@ -94,3 +94,10 @@ export interface EchartsTimeseriesChartProps
|
|||||||
|
|
||||||
export type TimeseriesChartTransformedProps =
|
export type TimeseriesChartTransformedProps =
|
||||||
EChartTransformedProps<EchartsTimeseriesFormData>;
|
EChartTransformedProps<EchartsTimeseriesFormData>;
|
||||||
|
|
||||||
|
export enum AxisType {
|
||||||
|
category = 'category',
|
||||||
|
value = 'value',
|
||||||
|
time = 'time',
|
||||||
|
log = 'log',
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user