mirror of
https://github.com/apache/superset.git
synced 2026-04-24 02:25:13 +00:00
feat(timeseries): remove stream style for bar charts (#37532)
This commit is contained in:
@@ -35,7 +35,7 @@ import {
|
||||
minorTicks,
|
||||
richTooltipSection,
|
||||
seriesOrderSection,
|
||||
showValueSection,
|
||||
showValueSectionWithoutStream,
|
||||
truncateXAxis,
|
||||
xAxisBounds,
|
||||
xAxisLabelRotation,
|
||||
@@ -327,7 +327,7 @@ const config: ControlPanelConfig = {
|
||||
...seriesOrderSection,
|
||||
['color_scheme'],
|
||||
['time_shift_color'],
|
||||
...showValueSection,
|
||||
...showValueSectionWithoutStream,
|
||||
[
|
||||
{
|
||||
name: 'stackDimension',
|
||||
@@ -375,11 +375,18 @@ const config: ControlPanelConfig = {
|
||||
],
|
||||
},
|
||||
],
|
||||
formDataOverrides: formData => ({
|
||||
...formData,
|
||||
metrics: getStandardizedControls().popAllMetrics(),
|
||||
groupby: getStandardizedControls().popAllColumns(),
|
||||
}),
|
||||
formDataOverrides: formData => {
|
||||
// Reset stack to null if it's Stream when switching to Bar chart
|
||||
const formDataWithStack = formData as Record<string, unknown>;
|
||||
return {
|
||||
...formData,
|
||||
metrics: getStandardizedControls().popAllMetrics(),
|
||||
groupby: getStandardizedControls().popAllColumns(),
|
||||
...(formDataWithStack.stack === StackControlsValue.Stream && {
|
||||
stack: null,
|
||||
}),
|
||||
};
|
||||
},
|
||||
};
|
||||
|
||||
export default config;
|
||||
|
||||
@@ -76,6 +76,14 @@ export const AreaChartStackControlOptions: [
|
||||
Exclude<ReactNode, null | undefined | boolean>,
|
||||
][] = [...StackControlOptions, [StackControlsValue.Expand, t('Expand')]];
|
||||
|
||||
export const StackControlOptionsWithoutStream: [
|
||||
JsonValue,
|
||||
Exclude<ReactNode, null | undefined | boolean>,
|
||||
][] = [
|
||||
[null, t('None')],
|
||||
[StackControlsValue.Stack, t('Stack')],
|
||||
];
|
||||
|
||||
export const TIMEGRAIN_TO_TIMESTAMP = {
|
||||
[TimeGranularity.HOUR]: 3600 * 1000,
|
||||
[TimeGranularity.DAY]: 3600 * 1000 * 24,
|
||||
|
||||
@@ -28,7 +28,11 @@ import {
|
||||
SORT_SERIES_CHOICES,
|
||||
sharedControls,
|
||||
} from '@superset-ui/chart-controls';
|
||||
import { DEFAULT_LEGEND_FORM_DATA, StackControlOptions } from './constants';
|
||||
import {
|
||||
DEFAULT_LEGEND_FORM_DATA,
|
||||
StackControlOptions,
|
||||
StackControlOptionsWithoutStream,
|
||||
} from './constants';
|
||||
import { DEFAULT_FORM_DATA } from './Timeseries/constants';
|
||||
import { defaultXAxis } from './defaults';
|
||||
|
||||
@@ -148,6 +152,14 @@ export const stackControl: ControlSetItem = {
|
||||
},
|
||||
};
|
||||
|
||||
export const stackControlWithoutStream: ControlSetItem = {
|
||||
...stackControl,
|
||||
config: {
|
||||
...stackControl.config,
|
||||
choices: StackControlOptionsWithoutStream,
|
||||
},
|
||||
};
|
||||
|
||||
export const onlyTotalControl: ControlSetItem = {
|
||||
name: 'only_total',
|
||||
config: {
|
||||
@@ -193,6 +205,13 @@ export const showValueSectionWithoutStack: ControlSetRow[] = [
|
||||
[onlyTotalControl],
|
||||
];
|
||||
|
||||
export const showValueSectionWithoutStream: ControlSetRow[] = [
|
||||
[showValueControl],
|
||||
[stackControlWithoutStream],
|
||||
[onlyTotalControl],
|
||||
[percentageThresholdControl],
|
||||
];
|
||||
|
||||
const richTooltipControl: ControlSetItem = {
|
||||
name: 'rich_tooltip',
|
||||
config: {
|
||||
|
||||
Reference in New Issue
Block a user