feat(MixedTimeSeries): Add onlyTotal and Sort Series to Mixed TimeSeries (#33634)

This commit is contained in:
nmdo
2025-06-09 17:59:54 -04:00
committed by GitHub
parent 2f007bf7a5
commit d11b6d557e
2 changed files with 87 additions and 20 deletions

View File

@@ -19,6 +19,7 @@
import { ensureIsArray, t } from '@superset-ui/core';
import { cloneDeep } from 'lodash';
import {
ControlPanelsContainerProps,
ControlPanelConfig,
ControlPanelSectionConfig,
ControlSetRow,
@@ -27,6 +28,8 @@ import {
getStandardizedControls,
sections,
sharedControls,
DEFAULT_SORT_SERIES_DATA,
SORT_SERIES_CHOICES,
} from '@superset-ui/chart-controls';
import { DEFAULT_FORM_DATA } from './types';
@@ -196,6 +199,23 @@ function createCustomizeSection(
},
},
],
[
{
name: `only_total${controlSuffix}`,
config: {
type: 'CheckboxControl',
label: t('Only Total'),
default: true,
renderTrigger: true,
description: t(
'Only show the total value on the stacked chart, and not show on the selected category',
),
visibility: ({ controls }: ControlPanelsContainerProps) =>
Boolean(controls?.show_value?.value) &&
Boolean(controls?.stack?.value),
},
},
],
[
{
name: `opacity${controlSuffix}`,
@@ -258,6 +278,35 @@ function createCustomizeSection(
},
},
],
[<ControlSubSectionHeader>{t('Series Order')}</ControlSubSectionHeader>],
[
{
name: `sort_series_type${controlSuffix}`,
config: {
type: 'SelectControl',
freeForm: false,
label: t('Sort Series By'),
choices: SORT_SERIES_CHOICES,
default: DEFAULT_SORT_SERIES_DATA.sort_series_type,
renderTrigger: true,
description: t(
'Based on what should series be ordered on the chart and legend',
),
},
},
],
[
{
name: `sort_series_ascending${controlSuffix}`,
config: {
type: 'CheckboxControl',
label: t('Sort Series Ascending'),
default: DEFAULT_SORT_SERIES_DATA.sort_series_ascending,
renderTrigger: true,
description: t('Sort series in ascending order'),
},
},
],
];
}