chore: move xaxis to superset-ui (#20438)

This commit is contained in:
Yongjie Zhao 2022-06-20 22:36:27 +08:00 committed by GitHub
parent 60eb1094a4
commit 111affdb02
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
32 changed files with 192 additions and 174 deletions

View File

@ -67,6 +67,8 @@ import {
ExtraControlProps,
SelectControlConfig,
Dataset,
ControlState,
ControlPanelState,
} from '../types';
import { ColumnOption } from '../components/ColumnOption';
@ -544,6 +546,30 @@ const enableExploreDnd = isFeatureEnabled(
FeatureFlag.ENABLE_EXPLORE_DRAG_AND_DROP,
);
const x_axis: SharedControlConfig = {
...(enableExploreDnd ? dndGroupByControl : groupByControl),
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],
};
const sharedControls = {
metrics: enableExploreDnd ? dnd_adhoc_metrics : metrics,
metric: enableExploreDnd ? dnd_adhoc_metric : metric,
@ -579,6 +605,7 @@ const sharedControls = {
series_limit_metric: enableExploreDnd ? dnd_sort_by : sort_by,
legacy_order_by: enableExploreDnd ? dnd_sort_by : sort_by,
truncate_metric,
x_axis,
};
export { sharedControls, dndEntity, dndColumnsControl };

View File

@ -25,7 +25,8 @@ import {
SetDataMaskHook,
} from '@superset-ui/core';
import { EChartsCoreOption } from 'echarts';
import { EchartsTitleFormData, DEFAULT_TITLE_FORM_DATA } from '../types';
import { EchartsTitleFormData } from '../types';
import { DEFAULT_TITLE_FORM_DATA } from '../constants';
export type BoxPlotQueryFormData = QueryFormData & {
numberFormat?: string;

View File

@ -35,7 +35,6 @@ import {
EchartsFunnelLabelTypeType,
FunnelChartTransformedProps,
} from './types';
import { DEFAULT_LEGEND_FORM_DATA } from '../types';
import {
extractGroupbyLabel,
getChartPadding,
@ -43,7 +42,7 @@ import {
sanitizeHtml,
} from '../utils/series';
import { defaultGrid, defaultTooltip } from '../defaults';
import { OpacityEnum } from '../constants';
import { OpacityEnum, DEFAULT_LEGEND_FORM_DATA } from '../constants';
const percentFormatter = getNumberFormatter(NumberFormats.PERCENT_2_POINT);

View File

@ -25,12 +25,8 @@ import {
QueryFormData,
SetDataMaskHook,
} from '@superset-ui/core';
import {
DEFAULT_LEGEND_FORM_DATA,
EchartsLegendFormData,
LegendOrientation,
LegendType,
} from '../types';
import { EchartsLegendFormData, LegendOrientation, LegendType } from '../types';
import { DEFAULT_LEGEND_FORM_DATA } from '../constants';
export type EchartsFunnelFormData = QueryFormData &
EchartsLegendFormData & {

View File

@ -22,7 +22,8 @@ import {
QueryFormColumn,
QueryFormData,
} from '@superset-ui/core';
import { DEFAULT_LEGEND_FORM_DATA, EChartTransformedProps } from '../types';
import { EChartTransformedProps } from '../types';
import { DEFAULT_LEGEND_FORM_DATA } from '../constants';
export type AxisTickLineStyle = {
width: number;

View File

@ -19,12 +19,8 @@
import { QueryFormData } from '@superset-ui/core';
import { GraphNodeItemOption } from 'echarts/types/src/chart/graph/GraphSeries';
import { SeriesTooltipOption } from 'echarts/types/src/util/types';
import {
DEFAULT_LEGEND_FORM_DATA,
EchartsLegendFormData,
LegendOrientation,
LegendType,
} from '../types';
import { EchartsLegendFormData, LegendOrientation, LegendType } from '../types';
import { DEFAULT_LEGEND_FORM_DATA } from '../constants';
export type EdgeSymbol = 'none' | 'circle' | 'arrow';

View File

@ -36,7 +36,7 @@ import {
import { DEFAULT_FORM_DATA } from './types';
import { EchartsTimeseriesSeriesType } from '../Timeseries/types';
import { legendSection, richTooltipSection, xAxisControl } from '../controls';
import { legendSection, richTooltipSection } from '../controls';
const {
area,
@ -295,7 +295,7 @@ const config: ControlPanelConfig = {
? {
label: t('Shared query fields'),
expanded: true,
controlSetRows: [[xAxisControl]],
controlSetRows: [['x_axis']],
}
: null,
createQuerySection(t('Query A'), ''),

View File

@ -28,17 +28,17 @@ import {
QueryFormColumn,
} from '@superset-ui/core';
import {
DEFAULT_LEGEND_FORM_DATA,
EchartsLegendFormData,
EchartsTitleFormData,
DEFAULT_TITLE_FORM_DATA,
StackType,
} from '../types';
import {
DEFAULT_FORM_DATA as TIMESERIES_DEFAULTS,
EchartsTimeseriesContributionType,
EchartsTimeseriesSeriesType,
} from '../Timeseries/types';
} from '../types';
import {
DEFAULT_LEGEND_FORM_DATA,
DEFAULT_TITLE_FORM_DATA,
DEFAULT_FORM_DATA as TIMESERIES_DEFAULTS,
} from '../constants';
export type EchartsMixedTimeseriesFormData = QueryFormData & {
annotationLayers: AnnotationLayer[];

View File

@ -36,7 +36,7 @@ import {
EchartsPieLabelType,
PieChartTransformedProps,
} from './types';
import { DEFAULT_LEGEND_FORM_DATA } from '../types';
import { DEFAULT_LEGEND_FORM_DATA, OpacityEnum } from '../constants';
import {
extractGroupbyLabel,
getChartPadding,
@ -45,7 +45,6 @@ import {
sanitizeHtml,
} from '../utils/series';
import { defaultGrid, defaultTooltip } from '../defaults';
import { OpacityEnum } from '../constants';
import { convertInteger } from '../utils/convertInteger';
const percentFormatter = getNumberFormatter(NumberFormats.PERCENT_2_POINT);

View File

@ -25,12 +25,8 @@ import {
QueryFormData,
SetDataMaskHook,
} from '@superset-ui/core';
import {
DEFAULT_LEGEND_FORM_DATA,
EchartsLegendFormData,
LegendOrientation,
LegendType,
} from '../types';
import { EchartsLegendFormData, LegendOrientation, LegendType } from '../types';
import { DEFAULT_LEGEND_FORM_DATA } from '../constants';
export type EchartsPieFormData = QueryFormData &
EchartsLegendFormData & {

View File

@ -36,7 +36,7 @@ import {
EchartsRadarLabelType,
RadarChartTransformedProps,
} from './types';
import { DEFAULT_LEGEND_FORM_DATA } from '../types';
import { DEFAULT_LEGEND_FORM_DATA, OpacityEnum } from '../constants';
import {
extractGroupbyLabel,
getChartPadding,
@ -44,7 +44,6 @@ import {
getLegendProps,
} from '../utils/series';
import { defaultGrid, defaultTooltip } from '../defaults';
import { OpacityEnum } from '../constants';
export function formatLabel({
params,

View File

@ -27,12 +27,12 @@ import {
SetDataMaskHook,
} from '@superset-ui/core';
import {
DEFAULT_LEGEND_FORM_DATA,
EchartsLegendFormData,
LabelPositionEnum,
LegendOrientation,
LegendType,
} from '../types';
import { DEFAULT_LEGEND_FORM_DATA } from '../constants';
type RadarColumnConfig = Record<string, { radarMetricMaxValue?: number }>;

View File

@ -17,7 +17,7 @@
* under the License.
*/
import React from 'react';
import { FeatureFlag, isFeatureEnabled, t } from '@superset-ui/core';
import { t } from '@superset-ui/core';
import {
ControlPanelConfig,
ControlPanelsContainerProps,
@ -28,10 +28,10 @@ import {
} from '@superset-ui/chart-controls';
import {
DEFAULT_FORM_DATA,
EchartsTimeseriesContributionType,
EchartsTimeseriesSeriesType,
} from '../types';
import { DEFAULT_FORM_DATA } from '../constants';
import {
legendSection,
onlyTotalControl,
@ -62,7 +62,7 @@ const config: ControlPanelConfig = {
label: t('Query'),
expanded: true,
controlSetRows: [
isFeatureEnabled(FeatureFlag.GENERIC_CHART_AXES) ? [xAxisControl] : [],
[xAxisControl],
['metrics'],
['groupby'],
[

View File

@ -17,7 +17,7 @@
* under the License.
*/
import React from 'react';
import { FeatureFlag, isFeatureEnabled, t } from '@superset-ui/core';
import { t } from '@superset-ui/core';
import {
ControlPanelConfig,
ControlPanelsContainerProps,
@ -31,10 +31,10 @@ import {
} from '@superset-ui/chart-controls';
import {
DEFAULT_FORM_DATA,
EchartsTimeseriesContributionType,
OrientationType,
} from '../../types';
import { DEFAULT_FORM_DATA } from '../../constants';
import {
legendSection,
richTooltipSection,
@ -269,7 +269,7 @@ const config: ControlPanelConfig = {
label: t('Query'),
expanded: true,
controlSetRows: [
isFeatureEnabled(FeatureFlag.GENERIC_CHART_AXES) ? [xAxisControl] : [],
[xAxisControl],
['metrics'],
['groupby'],
[

View File

@ -25,15 +25,15 @@ import {
isFeatureEnabled,
t,
} from '@superset-ui/core';
import buildQuery from '../../buildQuery';
import controlPanel from './controlPanel';
import transformProps from '../../transformProps';
import thumbnail from './images/thumbnail.png';
import {
EchartsTimeseriesChartProps,
EchartsTimeseriesFormData,
EchartsTimeseriesSeriesType,
} from '../../types';
import buildQuery from '../../buildQuery';
import controlPanel from './controlPanel';
import transformProps from '../../transformProps';
import thumbnail from './images/thumbnail.png';
import example1 from './images/Bar1.png';
import example2 from './images/Bar2.png';
import example3 from './images/Bar3.png';

View File

@ -17,7 +17,7 @@
* under the License.
*/
import React from 'react';
import { FeatureFlag, isFeatureEnabled, t } from '@superset-ui/core';
import { t } from '@superset-ui/core';
import {
ControlPanelConfig,
ControlPanelsContainerProps,
@ -28,16 +28,16 @@ import {
} from '@superset-ui/chart-controls';
import {
DEFAULT_FORM_DATA,
EchartsTimeseriesContributionType,
EchartsTimeseriesSeriesType,
} from './types';
} from '../../types';
import { DEFAULT_FORM_DATA } from '../../constants';
import {
legendSection,
richTooltipSection,
showValueSection,
xAxisControl,
} from '../controls';
} from '../../../controls';
const {
area,
@ -61,7 +61,7 @@ const config: ControlPanelConfig = {
label: t('Query'),
expanded: true,
controlSetRows: [
isFeatureEnabled(FeatureFlag.GENERIC_CHART_AXES) ? [xAxisControl] : [],
[xAxisControl],
['metrics'],
['groupby'],
[

View File

@ -25,15 +25,15 @@ import {
isFeatureEnabled,
t,
} from '@superset-ui/core';
import buildQuery from '../../buildQuery';
import controlPanel from '../controlPanel';
import transformProps from '../../transformProps';
import thumbnail from './images/thumbnail.png';
import {
EchartsTimeseriesChartProps,
EchartsTimeseriesFormData,
EchartsTimeseriesSeriesType,
} from '../../types';
import buildQuery from '../../buildQuery';
import controlPanel from './controlPanel';
import transformProps from '../../transformProps';
import thumbnail from './images/thumbnail.png';
import example1 from './images/Line1.png';
import example2 from './images/Line2.png';

View File

@ -17,7 +17,7 @@
* under the License.
*/
import React from 'react';
import { FeatureFlag, isFeatureEnabled, t } from '@superset-ui/core';
import { t } from '@superset-ui/core';
import {
ControlPanelConfig,
ControlPanelsContainerProps,
@ -27,7 +27,7 @@ import {
sharedControls,
} from '@superset-ui/chart-controls';
import { DEFAULT_FORM_DATA } from '../../types';
import { DEFAULT_FORM_DATA } from '../../constants';
import {
legendSection,
richTooltipSection,
@ -53,7 +53,7 @@ const config: ControlPanelConfig = {
label: t('Query'),
expanded: true,
controlSetRows: [
isFeatureEnabled(FeatureFlag.GENERIC_CHART_AXES) ? [xAxisControl] : [],
[xAxisControl],
['metrics'],
['groupby'],
['adhoc_filters'],

View File

@ -25,15 +25,15 @@ import {
isFeatureEnabled,
t,
} from '@superset-ui/core';
import buildQuery from '../../buildQuery';
import controlPanel from './controlPanel';
import transformProps from '../../transformProps';
import thumbnail from './images/thumbnail.png';
import {
EchartsTimeseriesChartProps,
EchartsTimeseriesFormData,
EchartsTimeseriesSeriesType,
} from '../../types';
import buildQuery from '../../buildQuery';
import controlPanel from './controlPanel';
import transformProps from '../../transformProps';
import thumbnail from './images/thumbnail.png';
import example1 from './images/Scatter1.png';
const scatterTransformProps = (chartProps: EchartsTimeseriesChartProps) =>

View File

@ -17,7 +17,7 @@
* under the License.
*/
import React from 'react';
import { FeatureFlag, isFeatureEnabled, t } from '@superset-ui/core';
import { t } from '@superset-ui/core';
import {
ControlPanelConfig,
ControlPanelsContainerProps,
@ -27,13 +27,14 @@ import {
sharedControls,
} from '@superset-ui/chart-controls';
import { DEFAULT_FORM_DATA, EchartsTimeseriesContributionType } from '../types';
import { EchartsTimeseriesContributionType } from '../../types';
import { DEFAULT_FORM_DATA } from '../../constants';
import {
legendSection,
richTooltipSection,
showValueSectionWithoutStack,
xAxisControl,
} from '../../controls';
} from '../../../controls';
const {
contributionMode,
@ -54,7 +55,7 @@ const config: ControlPanelConfig = {
label: t('Query'),
expanded: true,
controlSetRows: [
isFeatureEnabled(FeatureFlag.GENERIC_CHART_AXES) ? [xAxisControl] : [],
[xAxisControl],
['metrics'],
['groupby'],
[

View File

@ -25,15 +25,15 @@ import {
isFeatureEnabled,
t,
} from '@superset-ui/core';
import buildQuery from '../../buildQuery';
import controlPanel from '../controlPanel';
import transformProps from '../../transformProps';
import thumbnail from './images/thumbnail.png';
import {
EchartsTimeseriesChartProps,
EchartsTimeseriesFormData,
EchartsTimeseriesSeriesType,
} from '../../types';
import buildQuery from '../../buildQuery';
import controlPanel from './controlPanel';
import transformProps from '../../transformProps';
import thumbnail from './images/thumbnail.png';
import example1 from './images/SmoothLine1.png';
const smoothTransformProps = (chartProps: EchartsTimeseriesChartProps) =>

View File

@ -17,7 +17,7 @@
* under the License.
*/
import React from 'react';
import { FeatureFlag, isFeatureEnabled, t } from '@superset-ui/core';
import { t } from '@superset-ui/core';
import {
ControlPanelConfig,
ControlPanelsContainerProps,
@ -28,10 +28,10 @@ import {
} from '@superset-ui/chart-controls';
import {
DEFAULT_FORM_DATA,
EchartsTimeseriesContributionType,
EchartsTimeseriesSeriesType,
} from '../types';
} from '../../types';
import { DEFAULT_FORM_DATA } from '../constants';
import {
legendSection,
richTooltipSection,
@ -60,7 +60,7 @@ const config: ControlPanelConfig = {
label: t('Query'),
expanded: true,
controlSetRows: [
isFeatureEnabled(FeatureFlag.GENERIC_CHART_AXES) ? [xAxisControl] : [],
[xAxisControl],
['metrics'],
['groupby'],
[

View File

@ -25,14 +25,14 @@ import {
isFeatureEnabled,
t,
} from '@superset-ui/core';
import {
EchartsTimeseriesChartProps,
EchartsTimeseriesFormData,
} from '@superset-ui/plugin-chart-echarts';
import buildQuery from '../buildQuery';
import controlPanel from './controlPanel';
import transformProps from '../transformProps';
import thumbnail from './images/thumbnail.png';
import {
EchartsTimeseriesChartProps,
EchartsTimeseriesFormData,
} from '../types';
import example1 from './images/Step1.png';
import example2 from './images/Step2.png';

View File

@ -0,0 +1,66 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import { sections } from '@superset-ui/chart-controls';
import {
OrientationType,
EchartsTimeseriesSeriesType,
EchartsTimeseriesFormData,
} from './types';
import {
DEFAULT_LEGEND_FORM_DATA,
DEFAULT_TITLE_FORM_DATA,
} from '../constants';
// @ts-ignore
export const DEFAULT_FORM_DATA: EchartsTimeseriesFormData = {
...DEFAULT_LEGEND_FORM_DATA,
...DEFAULT_TITLE_FORM_DATA,
annotationLayers: sections.annotationLayers,
area: false,
forecastEnabled: sections.FORECAST_DEFAULT_DATA.forecastEnabled,
forecastInterval: sections.FORECAST_DEFAULT_DATA.forecastInterval,
forecastPeriods: sections.FORECAST_DEFAULT_DATA.forecastPeriods,
forecastSeasonalityDaily:
sections.FORECAST_DEFAULT_DATA.forecastSeasonalityDaily,
forecastSeasonalityWeekly:
sections.FORECAST_DEFAULT_DATA.forecastSeasonalityWeekly,
forecastSeasonalityYearly:
sections.FORECAST_DEFAULT_DATA.forecastSeasonalityYearly,
logAxis: false,
markerEnabled: false,
markerSize: 6,
minorSplitLine: false,
opacity: 0.2,
orderDesc: true,
rowLimit: 10000,
seriesType: EchartsTimeseriesSeriesType.Line,
stack: false,
tooltipTimeFormat: 'smart_date',
truncateYAxis: false,
yAxisBounds: [null, null],
zoomable: false,
richTooltip: true,
xAxisLabelRotation: 0,
emitFilter: false,
groupby: [],
showValue: false,
onlyTotal: false,
percentageThreshold: 0,
orientation: OrientationType.vertical,
};

View File

@ -26,7 +26,7 @@ import {
t,
} from '@superset-ui/core';
import buildQuery from './buildQuery';
import controlPanel from './controlPanel';
import controlPanel from './Regular/Line/controlPanel';
import transformProps from './transformProps';
import thumbnail from './images/thumbnail.png';
import {

View File

@ -36,13 +36,13 @@ import { isDerivedSeries } from '@superset-ui/chart-controls';
import { EChartsCoreOption, SeriesOption } from 'echarts';
import { ZRLineType } from 'echarts/types/src/util/types';
import {
DEFAULT_FORM_DATA,
EchartsTimeseriesChartProps,
EchartsTimeseriesFormData,
EchartsTimeseriesSeriesType,
TimeseriesChartTransformedProps,
OrientationType,
} from './types';
import { DEFAULT_FORM_DATA } from './constants';
import { ForecastSeriesEnum, ForecastValue } from '../types';
import { parseYAxisBound } from '../utils/controls';
import {

View File

@ -24,13 +24,10 @@ import {
QueryFormData,
TimeGranularity,
} from '@superset-ui/core';
import { sections } from '@superset-ui/chart-controls';
import {
DEFAULT_LEGEND_FORM_DATA,
EchartsLegendFormData,
EChartTransformedProps,
EchartsTitleFormData,
DEFAULT_TITLE_FORM_DATA,
StackType,
} from '../types';
@ -93,44 +90,6 @@ export type EchartsTimeseriesFormData = QueryFormData & {
} & EchartsLegendFormData &
EchartsTitleFormData;
// @ts-ignore
export const DEFAULT_FORM_DATA: EchartsTimeseriesFormData = {
...DEFAULT_LEGEND_FORM_DATA,
annotationLayers: sections.annotationLayers,
area: false,
forecastEnabled: sections.FORECAST_DEFAULT_DATA.forecastEnabled,
forecastInterval: sections.FORECAST_DEFAULT_DATA.forecastInterval,
forecastPeriods: sections.FORECAST_DEFAULT_DATA.forecastPeriods,
forecastSeasonalityDaily:
sections.FORECAST_DEFAULT_DATA.forecastSeasonalityDaily,
forecastSeasonalityWeekly:
sections.FORECAST_DEFAULT_DATA.forecastSeasonalityWeekly,
forecastSeasonalityYearly:
sections.FORECAST_DEFAULT_DATA.forecastSeasonalityYearly,
logAxis: false,
markerEnabled: false,
markerSize: 6,
minorSplitLine: false,
opacity: 0.2,
orderDesc: true,
rowLimit: 10000,
seriesType: EchartsTimeseriesSeriesType.Line,
stack: false,
tooltipTimeFormat: 'smart_date',
truncateYAxis: false,
yAxisBounds: [null, null],
zoomable: false,
richTooltip: true,
xAxisLabelRotation: 0,
emitFilter: false,
groupby: [],
showValue: false,
onlyTotal: false,
percentageThreshold: 0,
orientation: OrientationType.vertical,
...DEFAULT_TITLE_FORM_DATA,
};
export interface EchartsTimeseriesChartProps
extends ChartProps<EchartsTimeseriesFormData> {
formData: EchartsTimeseriesFormData;

View File

@ -19,7 +19,13 @@
import { JsonValue, t, TimeGranularity } from '@superset-ui/core';
import { ReactNode } from 'react';
import { LabelPositionEnum } from './types';
import {
EchartsLegendFormData,
EchartsTitleFormData,
LabelPositionEnum,
LegendOrientation,
LegendType,
} from './types';
// eslint-disable-next-line import/prefer-default-export
export const NULL_STRING = '<NULL>';
@ -84,3 +90,20 @@ export const TIMEGRAIN_TO_TIMESTAMP = {
[TimeGranularity.QUARTER]: 3600 * 1000 * 24 * 31 * 3,
[TimeGranularity.YEAR]: 3600 * 1000 * 24 * 31 * 12,
};
export const DEFAULT_LEGEND_FORM_DATA: EchartsLegendFormData = {
legendMargin: null,
legendOrientation: LegendOrientation.Top,
legendType: LegendType.Scroll,
showLegend: true,
};
export const DEFAULT_TITLE_FORM_DATA: EchartsTitleFormData = {
xAxisTitle: '',
xAxisTitleMargin: 0,
yAxisTitle: '',
yAxisTitleMargin: 0,
yAxisTitlePosition: 'Top',
};
export { DEFAULT_FORM_DATA } from './Timeseries/constants';

View File

@ -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',

View File

@ -45,7 +45,7 @@ export { default as TimeseriesTransformProps } from './Timeseries/transformProps
export { default as TreeTransformProps } from './Tree/transformProps';
export { default as TreemapTransformProps } from './Treemap/transformProps';
export { DEFAULT_FORM_DATA as TimeseriesDefaultFormData } from './Timeseries/types';
export { DEFAULT_FORM_DATA as TimeseriesDefaultFormData } from './Timeseries/constants';
export * from './types';

View File

@ -85,13 +85,6 @@ export type EchartsLegendFormData = {
showLegend: boolean;
};
export const DEFAULT_LEGEND_FORM_DATA: EchartsLegendFormData = {
legendMargin: null,
legendOrientation: LegendOrientation.Top,
legendType: LegendType.Scroll,
showLegend: true,
};
export type EventHandlers = Record<string, { (props: any): void }>;
export enum LabelPositionEnum {
@ -132,14 +125,6 @@ export interface EchartsTitleFormData {
yAxisTitlePosition: string;
}
export const DEFAULT_TITLE_FORM_DATA: EchartsTitleFormData = {
xAxisTitle: '',
xAxisTitleMargin: 0,
yAxisTitle: '',
yAxisTitleMargin: 0,
yAxisTitlePosition: 'Top',
};
export type StackType = boolean | null | Partial<AreaChartExtraControlsValue>;
export * from './Timeseries/types';

View File

@ -20,7 +20,7 @@ import {
isPostProcessingBoxplot,
PostProcessingBoxplot,
} from '@superset-ui/core';
import { DEFAULT_TITLE_FORM_DATA } from '../../src/types';
import { DEFAULT_TITLE_FORM_DATA } from '../../src/constants';
import buildQuery from '../../src/BoxPlot/buildQuery';
import { BoxPlotQueryFormData } from '../../src/BoxPlot/types';