mirror of
https://github.com/apache/superset.git
synced 2026-04-18 23:55:00 +00:00
refactor: preparation for time section migration (#21766)
This commit is contained in:
@@ -16,12 +16,7 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import {
|
||||
FeatureFlag,
|
||||
isFeatureEnabled,
|
||||
smartDateFormatter,
|
||||
t,
|
||||
} from '@superset-ui/core';
|
||||
import { hasGenericChartAxes, smartDateFormatter, t } from '@superset-ui/core';
|
||||
import {
|
||||
ControlPanelConfig,
|
||||
D3_FORMAT_DOCS,
|
||||
@@ -41,12 +36,8 @@ const config: ControlPanelConfig = {
|
||||
label: t('Query'),
|
||||
expanded: true,
|
||||
controlSetRows: [
|
||||
[isFeatureEnabled(FeatureFlag.GENERIC_CHART_AXES) ? 'x_axis' : null],
|
||||
[
|
||||
isFeatureEnabled(FeatureFlag.GENERIC_CHART_AXES)
|
||||
? 'time_grain_sqla'
|
||||
: null,
|
||||
],
|
||||
[hasGenericChartAxes ? 'x_axis' : null],
|
||||
[hasGenericChartAxes ? 'time_grain_sqla' : null],
|
||||
['metric'],
|
||||
['adhoc_filters'],
|
||||
],
|
||||
|
||||
@@ -17,12 +17,7 @@
|
||||
* under the License.
|
||||
*/
|
||||
import React from 'react';
|
||||
import {
|
||||
ensureIsArray,
|
||||
FeatureFlag,
|
||||
isFeatureEnabled,
|
||||
t,
|
||||
} from '@superset-ui/core';
|
||||
import { ensureIsArray, hasGenericChartAxes, t } from '@superset-ui/core';
|
||||
import { cloneDeep } from 'lodash';
|
||||
import {
|
||||
ControlPanelConfig,
|
||||
@@ -292,7 +287,7 @@ function createAdvancedAnalyticsSection(
|
||||
const config: ControlPanelConfig = {
|
||||
controlPanelSections: [
|
||||
sections.genericTime,
|
||||
isFeatureEnabled(FeatureFlag.GENERIC_CHART_AXES)
|
||||
hasGenericChartAxes
|
||||
? {
|
||||
label: t('Shared query fields'),
|
||||
expanded: true,
|
||||
|
||||
@@ -21,8 +21,7 @@ import {
|
||||
Behavior,
|
||||
ChartMetadata,
|
||||
ChartPlugin,
|
||||
FeatureFlag,
|
||||
isFeatureEnabled,
|
||||
hasGenericChartAxes,
|
||||
t,
|
||||
} from '@superset-ui/core';
|
||||
import buildQuery from './buildQuery';
|
||||
@@ -57,7 +56,7 @@ export default class EchartsTimeseriesChartPlugin extends ChartPlugin<
|
||||
behaviors: [Behavior.INTERACTIVE_CHART],
|
||||
category: t('Evolution'),
|
||||
credits: ['https://echarts.apache.org'],
|
||||
description: isFeatureEnabled(FeatureFlag.GENERIC_CHART_AXES)
|
||||
description: hasGenericChartAxes
|
||||
? t(
|
||||
'Visualize two different series using the same x-axis. Note that both series can be visualized with a different chart type (e.g. 1 using bars and 1 using a line).',
|
||||
)
|
||||
@@ -70,9 +69,7 @@ export default class EchartsTimeseriesChartPlugin extends ChartPlugin<
|
||||
AnnotationType.Interval,
|
||||
AnnotationType.Timeseries,
|
||||
],
|
||||
name: isFeatureEnabled(FeatureFlag.GENERIC_CHART_AXES)
|
||||
? t('Mixed Chart')
|
||||
: t('Mixed Time-Series'),
|
||||
name: hasGenericChartAxes ? t('Mixed Chart') : t('Mixed Time-Series'),
|
||||
thumbnail,
|
||||
tags: [
|
||||
t('Advanced-Analytics'),
|
||||
|
||||
@@ -22,8 +22,7 @@ import {
|
||||
ChartPlugin,
|
||||
AnnotationType,
|
||||
Behavior,
|
||||
isFeatureEnabled,
|
||||
FeatureFlag,
|
||||
hasGenericChartAxes,
|
||||
} from '@superset-ui/core';
|
||||
import buildQuery from '../buildQuery';
|
||||
import controlPanel from './controlPanel';
|
||||
@@ -54,7 +53,7 @@ export default class EchartsAreaChartPlugin extends ChartPlugin<
|
||||
behaviors: [Behavior.INTERACTIVE_CHART],
|
||||
category: t('Evolution'),
|
||||
credits: ['https://echarts.apache.org'],
|
||||
description: isFeatureEnabled(FeatureFlag.GENERIC_CHART_AXES)
|
||||
description: hasGenericChartAxes
|
||||
? t(
|
||||
'Area charts are similar to line charts in that they represent variables with the same scale, but area charts stack the metrics on top of each other.',
|
||||
)
|
||||
@@ -68,7 +67,7 @@ export default class EchartsAreaChartPlugin extends ChartPlugin<
|
||||
AnnotationType.Interval,
|
||||
AnnotationType.Timeseries,
|
||||
],
|
||||
name: isFeatureEnabled(FeatureFlag.GENERIC_CHART_AXES)
|
||||
name: hasGenericChartAxes
|
||||
? t('Area Chart v2')
|
||||
: t('Time-series Area Chart'),
|
||||
tags: [
|
||||
|
||||
@@ -21,8 +21,7 @@ import {
|
||||
Behavior,
|
||||
ChartMetadata,
|
||||
ChartPlugin,
|
||||
FeatureFlag,
|
||||
isFeatureEnabled,
|
||||
hasGenericChartAxes,
|
||||
t,
|
||||
} from '@superset-ui/core';
|
||||
import {
|
||||
@@ -60,7 +59,7 @@ export default class EchartsTimeseriesBarChartPlugin extends ChartPlugin<
|
||||
behaviors: [Behavior.INTERACTIVE_CHART],
|
||||
category: t('Evolution'),
|
||||
credits: ['https://echarts.apache.org'],
|
||||
description: isFeatureEnabled(FeatureFlag.GENERIC_CHART_AXES)
|
||||
description: hasGenericChartAxes
|
||||
? t('Bar Charts are used to show metrics as a series of bars.')
|
||||
: t(
|
||||
'Time-series Bar Charts are used to show the changes in a metric over time as a series of bars.',
|
||||
@@ -76,7 +75,7 @@ export default class EchartsTimeseriesBarChartPlugin extends ChartPlugin<
|
||||
AnnotationType.Interval,
|
||||
AnnotationType.Timeseries,
|
||||
],
|
||||
name: isFeatureEnabled(FeatureFlag.GENERIC_CHART_AXES)
|
||||
name: hasGenericChartAxes
|
||||
? t('Bar Chart v2')
|
||||
: t('Time-series Bar Chart v2'),
|
||||
tags: [
|
||||
|
||||
@@ -21,8 +21,7 @@ import {
|
||||
Behavior,
|
||||
ChartMetadata,
|
||||
ChartPlugin,
|
||||
FeatureFlag,
|
||||
isFeatureEnabled,
|
||||
hasGenericChartAxes,
|
||||
t,
|
||||
} from '@superset-ui/core';
|
||||
import {
|
||||
@@ -59,7 +58,7 @@ export default class EchartsTimeseriesLineChartPlugin extends ChartPlugin<
|
||||
behaviors: [Behavior.INTERACTIVE_CHART],
|
||||
category: t('Evolution'),
|
||||
credits: ['https://echarts.apache.org'],
|
||||
description: isFeatureEnabled(FeatureFlag.GENERIC_CHART_AXES)
|
||||
description: hasGenericChartAxes
|
||||
? t(
|
||||
'Line chart is used to visualize measurements taken over a given category. Line chart is a type of chart which displays information as a series of data points connected by straight line segments. It is a basic type of chart common in many fields.',
|
||||
)
|
||||
@@ -73,7 +72,7 @@ export default class EchartsTimeseriesLineChartPlugin extends ChartPlugin<
|
||||
AnnotationType.Interval,
|
||||
AnnotationType.Timeseries,
|
||||
],
|
||||
name: isFeatureEnabled(FeatureFlag.GENERIC_CHART_AXES)
|
||||
name: hasGenericChartAxes
|
||||
? t('Line Chart v2')
|
||||
: t('Time-series Line Chart'),
|
||||
tags: [
|
||||
|
||||
@@ -21,8 +21,7 @@ import {
|
||||
Behavior,
|
||||
ChartMetadata,
|
||||
ChartPlugin,
|
||||
FeatureFlag,
|
||||
isFeatureEnabled,
|
||||
hasGenericChartAxes,
|
||||
t,
|
||||
} from '@superset-ui/core';
|
||||
import {
|
||||
@@ -58,7 +57,7 @@ export default class EchartsTimeseriesScatterChartPlugin extends ChartPlugin<
|
||||
behaviors: [Behavior.INTERACTIVE_CHART],
|
||||
category: t('Evolution'),
|
||||
credits: ['https://echarts.apache.org'],
|
||||
description: isFeatureEnabled(FeatureFlag.GENERIC_CHART_AXES)
|
||||
description: hasGenericChartAxes
|
||||
? t(
|
||||
'Scatter Plot has the horizontal axis in linear units, and the points are connected in order. It shows a statistical relationship between two variables.',
|
||||
)
|
||||
@@ -72,7 +71,7 @@ export default class EchartsTimeseriesScatterChartPlugin extends ChartPlugin<
|
||||
AnnotationType.Interval,
|
||||
AnnotationType.Timeseries,
|
||||
],
|
||||
name: isFeatureEnabled(FeatureFlag.GENERIC_CHART_AXES)
|
||||
name: hasGenericChartAxes
|
||||
? t('Scatter Plot')
|
||||
: t('Time-series Scatter Plot'),
|
||||
tags: [
|
||||
|
||||
@@ -21,8 +21,7 @@ import {
|
||||
Behavior,
|
||||
ChartMetadata,
|
||||
ChartPlugin,
|
||||
FeatureFlag,
|
||||
isFeatureEnabled,
|
||||
hasGenericChartAxes,
|
||||
t,
|
||||
} from '@superset-ui/core';
|
||||
import {
|
||||
@@ -58,7 +57,7 @@ export default class EchartsTimeseriesSmoothLineChartPlugin extends ChartPlugin<
|
||||
behaviors: [Behavior.INTERACTIVE_CHART],
|
||||
category: t('Evolution'),
|
||||
credits: ['https://echarts.apache.org'],
|
||||
description: isFeatureEnabled(FeatureFlag.GENERIC_CHART_AXES)
|
||||
description: hasGenericChartAxes
|
||||
? t(
|
||||
'Smooth-line is a variation of the line chart. Without angles and hard edges, Smooth-line sometimes looks smarter and more professional.',
|
||||
)
|
||||
@@ -72,7 +71,7 @@ export default class EchartsTimeseriesSmoothLineChartPlugin extends ChartPlugin<
|
||||
AnnotationType.Interval,
|
||||
AnnotationType.Timeseries,
|
||||
],
|
||||
name: isFeatureEnabled(FeatureFlag.GENERIC_CHART_AXES)
|
||||
name: hasGenericChartAxes
|
||||
? t('Smooth Line')
|
||||
: t('Time-series Smooth Line'),
|
||||
tags: [
|
||||
|
||||
@@ -21,8 +21,7 @@ import {
|
||||
Behavior,
|
||||
ChartMetadata,
|
||||
ChartPlugin,
|
||||
FeatureFlag,
|
||||
isFeatureEnabled,
|
||||
hasGenericChartAxes,
|
||||
t,
|
||||
} from '@superset-ui/core';
|
||||
import {
|
||||
@@ -49,7 +48,7 @@ export default class EchartsTimeseriesStepChartPlugin extends ChartPlugin<
|
||||
behaviors: [Behavior.INTERACTIVE_CHART],
|
||||
category: t('Evolution'),
|
||||
credits: ['https://echarts.apache.org'],
|
||||
description: isFeatureEnabled(FeatureFlag.GENERIC_CHART_AXES)
|
||||
description: hasGenericChartAxes
|
||||
? t(
|
||||
'Stepped-line graph (also called step chart) is a variation of line chart but with the line forming a series of steps between data points. A step chart can be useful when you want to show the changes that occur at irregular intervals.',
|
||||
)
|
||||
@@ -63,7 +62,7 @@ export default class EchartsTimeseriesStepChartPlugin extends ChartPlugin<
|
||||
AnnotationType.Interval,
|
||||
AnnotationType.Timeseries,
|
||||
],
|
||||
name: isFeatureEnabled(FeatureFlag.GENERIC_CHART_AXES)
|
||||
name: hasGenericChartAxes
|
||||
? t('Stepped Line')
|
||||
: t('Time-series Stepped Line'),
|
||||
tags: [
|
||||
|
||||
@@ -21,8 +21,7 @@ import {
|
||||
Behavior,
|
||||
ChartMetadata,
|
||||
ChartPlugin,
|
||||
FeatureFlag,
|
||||
isFeatureEnabled,
|
||||
hasGenericChartAxes,
|
||||
t,
|
||||
} from '@superset-ui/core';
|
||||
import buildQuery from './buildQuery';
|
||||
@@ -48,7 +47,7 @@ export default class EchartsTimeseriesChartPlugin extends ChartPlugin<
|
||||
behaviors: [Behavior.INTERACTIVE_CHART],
|
||||
category: t('Evolution'),
|
||||
credits: ['https://echarts.apache.org'],
|
||||
description: isFeatureEnabled(FeatureFlag.GENERIC_CHART_AXES)
|
||||
description: hasGenericChartAxes
|
||||
? t(
|
||||
'Swiss army knife for visualizing data. Choose between step, line, scatter, and bar charts. This viz type has many customization options as well.',
|
||||
)
|
||||
@@ -62,9 +61,7 @@ export default class EchartsTimeseriesChartPlugin extends ChartPlugin<
|
||||
AnnotationType.Interval,
|
||||
AnnotationType.Timeseries,
|
||||
],
|
||||
name: isFeatureEnabled(FeatureFlag.GENERIC_CHART_AXES)
|
||||
? t('Generic Chart')
|
||||
: t('Time-series Chart'),
|
||||
name: hasGenericChartAxes ? t('Generic Chart') : t('Time-series Chart'),
|
||||
tags: [
|
||||
t('Advanced-Analytics'),
|
||||
t('Aesthetic'),
|
||||
|
||||
Reference in New Issue
Block a user