mirror of
https://github.com/apache/superset.git
synced 2026-04-25 02:55:07 +00:00
chore: move xaxis to superset-ui (#20438)
This commit is contained in:
@@ -17,22 +17,15 @@
|
||||
* under the License.
|
||||
*/
|
||||
import React from 'react';
|
||||
import {
|
||||
FeatureFlag,
|
||||
isFeatureEnabled,
|
||||
t,
|
||||
validateNonEmpty,
|
||||
} from '@superset-ui/core';
|
||||
import { FeatureFlag, isFeatureEnabled, t } from '@superset-ui/core';
|
||||
import {
|
||||
ControlPanelsContainerProps,
|
||||
ControlPanelState,
|
||||
ControlSetItem,
|
||||
ControlSetRow,
|
||||
ControlState,
|
||||
sharedControls,
|
||||
} from '@superset-ui/chart-controls';
|
||||
import { DEFAULT_LEGEND_FORM_DATA } from './types';
|
||||
import { DEFAULT_FORM_DATA } from './Timeseries/types';
|
||||
import { DEFAULT_LEGEND_FORM_DATA } from './constants';
|
||||
import { DEFAULT_FORM_DATA } from './Timeseries/constants';
|
||||
|
||||
const { legendMargin, legendOrientation, legendType, showLegend } =
|
||||
DEFAULT_LEGEND_FORM_DATA;
|
||||
@@ -145,32 +138,9 @@ export const onlyTotalControl: ControlSetItem = {
|
||||
},
|
||||
};
|
||||
|
||||
export const xAxisControl: ControlSetItem = {
|
||||
name: 'x_axis',
|
||||
config: {
|
||||
...sharedControls.groupby,
|
||||
label: t('X-axis'),
|
||||
default: (
|
||||
control: ControlState,
|
||||
controlPanel: Partial<ControlPanelState>,
|
||||
) => {
|
||||
// default to the chosen time column if x-axis is unset and the
|
||||
// GENERIC_CHART_AXES feature flag is enabled
|
||||
const { value } = control;
|
||||
if (value) {
|
||||
return value;
|
||||
}
|
||||
const timeColumn = controlPanel?.form_data?.granularity_sqla;
|
||||
if (isFeatureEnabled(FeatureFlag.GENERIC_CHART_AXES) && timeColumn) {
|
||||
return timeColumn;
|
||||
}
|
||||
return null;
|
||||
},
|
||||
multi: false,
|
||||
description: t('Dimension to use on x-axis.'),
|
||||
validators: [validateNonEmpty],
|
||||
},
|
||||
};
|
||||
export const xAxisControl = isFeatureEnabled(FeatureFlag.GENERIC_CHART_AXES)
|
||||
? 'x_axis'
|
||||
: null;
|
||||
|
||||
const percentageThresholdControl: ControlSetItem = {
|
||||
name: 'percentage_threshold',
|
||||
|
||||
Reference in New Issue
Block a user