Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import {
minorTicks,
richTooltipSection,
seriesOrderSection,
showValueSection,
showValueSectionWithoutStream,
truncateXAxis,
xAxisBounds,
xAxisLabelRotation,
Expand Down Expand Up @@ -325,7 +325,7 @@ const config: ControlPanelConfig = {
...seriesOrderSection,
['color_scheme'],
['time_shift_color'],
...showValueSection,
...showValueSectionWithoutStream,
[
{
name: 'stackDimension',
Expand Down Expand Up @@ -373,11 +373,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;
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,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,
Expand Down
21 changes: 20 additions & 1 deletion superset-frontend/plugins/plugin-chart-echarts/src/controls.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -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: {
Expand Down Expand Up @@ -193,6 +205,13 @@ export const showValueSectionWithoutStack: ControlSetRow[] = [
[onlyTotalControl],
];

export const showValueSectionWithoutStream: ControlSetRow[] = [
[showValueControl],
[stackControlWithoutStream],
[onlyTotalControl],
[percentageThresholdControl],
];

const richTooltipControl: ControlSetItem = {
name: 'rich_tooltip',
config: {
Expand Down
Loading
Loading