Skip to content

Commit

Permalink
type
Browse files Browse the repository at this point in the history
  • Loading branch information
zhaoyongjie committed Jun 20, 2022
1 parent 822b111 commit af14267
Show file tree
Hide file tree
Showing 28 changed files with 129 additions and 111 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,14 @@ import {
EchartsFunnelLabelTypeType,
FunnelChartTransformedProps,
} from './types';
import { DEFAULT_LEGEND_FORM_DATA } from '../types';
import {
extractGroupbyLabel,
getChartPadding,
getLegendProps,
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);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 & {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,17 @@ import {
QueryFormColumn,
} from '@superset-ui/core';
import {
DEFAULT_LEGEND_FORM_DATA,
EchartsLegendFormData,
EchartsTitleFormData,
DEFAULT_TITLE_FORM_DATA,
StackType,
EchartsTimeseriesContributionType,
EchartsTimeseriesSeriesType,
} from '../types';
import {
DEFAULT_LEGEND_FORM_DATA,
DEFAULT_TITLE_FORM_DATA,
DEFAULT_FORM_DATA as TIMESERIES_DEFAULTS,
EchartsTimeseriesContributionType,
EchartsTimeseriesSeriesType,
} from '../Timeseries/types';
} from '../constants';

export type EchartsMixedTimeseriesFormData = QueryFormData & {
annotationLayers: AnnotationLayer[];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 & {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,14 @@ import {
EchartsRadarLabelType,
RadarChartTransformedProps,
} from './types';
import { DEFAULT_LEGEND_FORM_DATA } from '../types';
import { DEFAULT_LEGEND_FORM_DATA, OpacityEnum } from '../constants';
import {
extractGroupbyLabel,
getChartPadding,
getColtypesMapping,
getLegendProps,
} from '../utils/series';
import { defaultGrid, defaultTooltip } from '../defaults';
import { OpacityEnum } from '../constants';

export function formatLabel({
params,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 }>;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ import {
} from '@superset-ui/chart-controls';

import {
DEFAULT_FORM_DATA,
EchartsTimeseriesContributionType,
EchartsTimeseriesSeriesType,
} from '@superset-ui/plugin-chart-echarts';
} from '../types';
import { DEFAULT_FORM_DATA } from '../constants';
import {
legendSection,
onlyTotalControl,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ import {
} from '@superset-ui/chart-controls';

import {
DEFAULT_FORM_DATA,
EchartsTimeseriesContributionType,
OrientationType,
} from '@superset-ui/plugin-chart-echarts';
} from '../../types';
import { DEFAULT_FORM_DATA } from '../../constants';
import {
legendSection,
richTooltipSection,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import {
EchartsTimeseriesChartProps,
EchartsTimeseriesFormData,
EchartsTimeseriesSeriesType,
} from '@superset-ui/plugin-chart-echarts';
} from '../../types';
import buildQuery from '../../buildQuery';
import controlPanel from './controlPanel';
import transformProps from '../../transformProps';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ import {
} from '@superset-ui/chart-controls';

import {
DEFAULT_FORM_DATA,
EchartsTimeseriesContributionType,
EchartsTimeseriesSeriesType,
} from '@superset-ui/plugin-chart-echarts';
} from '../../types';
import { DEFAULT_FORM_DATA } from '../../constants';
import {
legendSection,
richTooltipSection,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import {
EchartsTimeseriesChartProps,
EchartsTimeseriesFormData,
EchartsTimeseriesSeriesType,
} from '@superset-ui/plugin-chart-echarts';
} from '../../types';
import buildQuery from '../../buildQuery';
import controlPanel from './controlPanel';
import transformProps from '../../transformProps';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import {
sharedControls,
} from '@superset-ui/chart-controls';

import { DEFAULT_FORM_DATA } from '@superset-ui/plugin-chart-echarts';
import { DEFAULT_FORM_DATA } from '../../constants';
import {
legendSection,
richTooltipSection,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import {
EchartsTimeseriesChartProps,
EchartsTimeseriesFormData,
EchartsTimeseriesSeriesType,
} from '@superset-ui/plugin-chart-echarts';
} from '../../types';
import buildQuery from '../../buildQuery';
import controlPanel from './controlPanel';
import transformProps from '../../transformProps';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,8 @@ import {
sharedControls,
} from '@superset-ui/chart-controls';

import {
DEFAULT_FORM_DATA,
EchartsTimeseriesContributionType,
} from '@superset-ui/plugin-chart-echarts';
import { EchartsTimeseriesContributionType } from '../../types';
import { DEFAULT_FORM_DATA } from '../../constants';
import {
legendSection,
richTooltipSection,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import {
EchartsTimeseriesChartProps,
EchartsTimeseriesFormData,
EchartsTimeseriesSeriesType,
} from '@superset-ui/plugin-chart-echarts';
} from '../../types';
import buildQuery from '../../buildQuery';
import controlPanel from './controlPanel';
import transformProps from '../../transformProps';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ import {
} from '@superset-ui/chart-controls';

import {
DEFAULT_FORM_DATA,
EchartsTimeseriesContributionType,
EchartsTimeseriesSeriesType,
} from '@superset-ui/plugin-chart-echarts';
} from '../../types';
import { DEFAULT_FORM_DATA } from '../constants';
import {
legendSection,
richTooltipSection,
Expand Down
Original file line number Diff line number Diff line change
@@ -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,
};
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Loading

0 comments on commit af14267

Please sign in to comment.