mirror of
https://github.com/apache/superset.git
synced 2026-04-20 16:44:46 +00:00
feat: Axis sort in the Bar Chart V2 (#21993)
This commit is contained in:
@@ -38,7 +38,7 @@ export default function buildQuery(formData: BoxPlotQueryFormData) {
|
||||
if (
|
||||
isPhysicalColumn(col) &&
|
||||
formData.time_grain_sqla &&
|
||||
formData?.datetime_columns_lookup?.[col]
|
||||
formData?.temporal_columns_lookup?.[col]
|
||||
) {
|
||||
return {
|
||||
timeGrain: formData.time_grain_sqla,
|
||||
|
||||
@@ -73,7 +73,7 @@ const config: ControlPanelConfig = {
|
||||
},
|
||||
},
|
||||
},
|
||||
'datetime_columns_lookup',
|
||||
'temporal_columns_lookup',
|
||||
],
|
||||
['groupby'],
|
||||
['metrics'],
|
||||
|
||||
@@ -41,7 +41,6 @@ import {
|
||||
const {
|
||||
logAxis,
|
||||
minorSplitLine,
|
||||
rowLimit,
|
||||
truncateYAxis,
|
||||
yAxisBounds,
|
||||
zoomable,
|
||||
@@ -260,7 +259,7 @@ function createAxisControl(axis: 'x' | 'y'): ControlSetRow[] {
|
||||
const config: ControlPanelConfig = {
|
||||
controlPanelSections: [
|
||||
sections.genericTime,
|
||||
sections.echartsTimeSeriesQuery,
|
||||
sections.echartsTimeSeriesQueryWithXAxisSort,
|
||||
sections.advancedAnalyticsControls,
|
||||
sections.annotationsAndLayersControls,
|
||||
sections.forecastIntervalControls,
|
||||
@@ -324,40 +323,6 @@ const config: ControlPanelConfig = {
|
||||
],
|
||||
},
|
||||
],
|
||||
controlOverrides: {
|
||||
row_limit: {
|
||||
default: rowLimit,
|
||||
},
|
||||
limit: {
|
||||
rerender: ['timeseries_limit_metric', 'order_desc'],
|
||||
},
|
||||
timeseries_limit_metric: {
|
||||
label: t('Series Limit Sort By'),
|
||||
description: t(
|
||||
'Metric used to order the limit if a series limit is present. ' +
|
||||
'If undefined reverts to the first metric (where appropriate).',
|
||||
),
|
||||
visibility: ({ controls }) => Boolean(controls?.limit.value),
|
||||
mapStateToProps: (state, controlState) => {
|
||||
const timeserieslimitProps =
|
||||
sharedControls.timeseries_limit_metric.mapStateToProps?.(
|
||||
state,
|
||||
controlState,
|
||||
) || {};
|
||||
timeserieslimitProps.value = state.controls?.limit?.value
|
||||
? controlState?.value
|
||||
: [];
|
||||
return timeserieslimitProps;
|
||||
},
|
||||
},
|
||||
order_desc: {
|
||||
label: t('Series Limit Sort Descending'),
|
||||
default: false,
|
||||
description: t(
|
||||
'Whether to sort descending or ascending if a series limit is present',
|
||||
),
|
||||
},
|
||||
},
|
||||
formDataOverrides: formData => ({
|
||||
...formData,
|
||||
metrics: getStandardizedControls().popAllMetrics(),
|
||||
|
||||
@@ -36,6 +36,7 @@ import {
|
||||
prophetOperator,
|
||||
timeComparePivotOperator,
|
||||
flattenOperator,
|
||||
sortOperator,
|
||||
} from '@superset-ui/chart-controls';
|
||||
|
||||
export default function buildQuery(formData: QueryFormData) {
|
||||
@@ -95,6 +96,7 @@ export default function buildQuery(formData: QueryFormData) {
|
||||
resampleOperator(formData, baseQueryObject),
|
||||
renameOperator(formData, baseQueryObject),
|
||||
contributionOperator(formData, baseQueryObject),
|
||||
sortOperator(formData, baseQueryObject),
|
||||
flattenOperator(formData, baseQueryObject),
|
||||
// todo: move prophet before flatten
|
||||
prophetOperator(formData, baseQueryObject),
|
||||
|
||||
Reference in New Issue
Block a user