mirror of
https://github.com/apache/superset.git
synced 2026-04-24 02:25:13 +00:00
chore: move xaxis to superset-ui (#20438)
This commit is contained in:
@@ -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'],
|
||||
[
|
||||
|
||||
@@ -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'],
|
||||
[
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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'],
|
||||
[
|
||||
@@ -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';
|
||||
|
||||
|
||||
@@ -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'],
|
||||
|
||||
@@ -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) =>
|
||||
|
||||
@@ -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'],
|
||||
[
|
||||
@@ -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) =>
|
||||
|
||||
@@ -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'],
|
||||
[
|
||||
|
||||
@@ -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';
|
||||
|
||||
|
||||
@@ -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,
|
||||
};
|
||||
@@ -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 {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user