Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: DVT-243 #278

Merged
merged 13 commits into from
Apr 18, 2024
273 changes: 273 additions & 0 deletions superset-frontend/src/pages/DvtChart/dvtChartData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1226,6 +1226,279 @@ const DvtChartData: DvtChartDataProps[] = [
},
],
},
{
chart_name: 'mixed_timeseries',
collapses: [
{
collapse_label: t('Shared query fields'),
collapse_active: 'sharedQueryFields',
collapse_popper_error: t('This section contains validation errors'),
forms: [
{
label: t('X-AXIS'),
name: 'x_axis',
popper: t('Dimension to use on x-axis.'),
popperError: t('cannot be empty'),
status: 'input-drop',
multiple: false,
type: 'normal',
savedType: 'expressions',
},
],
},
{
collapse_label: t('Query A'),
collapse_active: 'queryA',
collapse_popper_error: t('This section contains validation errors'),
forms: [
formMetrics,
formDimensions,
formFilters,
{
label: t('SERIES LIMIT'),
name: 'series_limit',
popper: t(
'Limits the number of series that get displayed. A joined subquery (or an extra phase where subqueries are not supported) is applied to limit the number of series that get fetched and rendered. This feature is useful when grouping by high cardinality column(s) though does increase the query complexity and cost.',
),
placeholder: t('None'),
status: 'select',
options: chartFormsOption.limit,
},
formSortBy,
sortDescending,
formRowLimit,
{
label: t('TRUNCATE METRIC'),
name: 'truncate_metric',
status: 'checkbox',
},
],
},
{
collapse_label: t('Advanced analytics Query A '),
collapse_active: 'advancedA',
collapse_popper: t(
'This section contains options that allow for advanced analytical post processing of query results',
),
forms: [
{
label: t('ROLLING FUNCTION'),
name: 'rolling_type',
popper: t(
'Defines a rolling window function to apply, works along with the [Periods] text box',
),
placeholder: t('Select ...'),
status: 'select',
options: chartFormsOption.rolling_type,
},
{
label: t('PERIODS'),
name: 'rolling_periods',
popper: t(
'Defines the size of the rolling window function, relative to the time granularity selected',
),
status: 'input',
number: true,
},
{
label: t('MIN PERIODS'),
name: 'min_periods',
popper: t(
'The minimum number of rolling periods required to show a value. For instance if you do a cumulative sum on 7 days you may want your "Min Period" to be 7, so that all data points shown are the total of 7 periods. This will hide the "ramp up" taking place over the first 7 periods',
),
status: 'input',
number: true,
},
{
label: t('TIME SHIFT'),
name: 'time_compare',
popper: t(
'Overlay one or more timeseries from a relative time period. Expects relative time deltas in natural language (example: 24 hours, 7 days, 52 weeks, 365 days). Free text is supported.',
),
placeholder: t('Select ...'),
status: 'multiple-select',
options: chartFormsOption.time_compare,
},
{
label: t('CALCULATION TYPE'),
name: 'comparison_type',
popper: t(
'How to display time shifts: as individual lines; as the difference between the main time series and each time shift; as the percentage change; or as the ratio between series and time shifts.',
),
placeholder: t('Select ...'),
status: 'select',
options: chartFormsOption.comparison_type,
},
{
label: t('RULE'),
name: 'resample_rule',
popper: t('Pandas resample rule'),
placeholder: t('Select ...'),
status: 'select',
options: chartFormsOption.resample_rule,
},
{
label: t('FILL METHOD'),
name: 'resample_method',
popper: t('Pandas resample method'),
placeholder: t('Select ...'),
status: 'select',
options: chartFormsOption.resample_method,
},
],
},
{
collapse_label: t('Query B'),
collapse_active: 'queryB',
collapse_popper_error: t('This section contains validation errors'),
forms: [
{
label: t('METRICS'),
name: 'metrics_b',
popper: t(
'Select one or many metrics to display. You can use an aggregation function on a column or write custom SQL to create a metric.',
),
popperError: t('cannot be empty'),
status: 'input-drop',
multiple: true,
type: 'aggregates',
savedType: 'metric',
},
{
label: t('DIMENSIONS'),
name: 'groupby_b',
popper: t(
'Dimensions contain qualitative values such as names, dates, or geographical data. Use dimensions to categorize, segment, and reveal the details in your data. Dimensions affect the level of detail in the view.',
),
status: 'input-drop',
multiple: true,
type: 'normal',
savedType: 'expressions',
},
{
label: t('FILTERS'),
name: 'adhoc_filters_b',
status: 'input-drop',
multiple: true,
type: 'filters',
},
{
label: t('SERIES LIMIT'),
name: 'series_limit_b',
popper: t(
'Limits the number of series that get displayed. A joined subquery (or an extra phase where subqueries are not supported) is applied to limit the number of series that get fetched and rendered. This feature is useful when grouping by high cardinality column(s) though does increase the query complexity and cost.',
),
placeholder: t('None'),
status: 'select',
options: chartFormsOption.limit,
},
{
label: t('SORT BY'),
name: 'timeseries_limit_metric_b',
popper: t(
'This metric is used to define row selection criteria (how the rows are sorted) if a series or row limit is present. If not defined, it reverts to the first metric (where appropriate).',
),
status: 'input-drop',
multiple: false,
type: 'aggregates',
savedType: 'metric',
},
{
label: t('SORT DESCENDING'),
name: 'order_desc_b',
status: 'checkbox',
},
{
label: t('ROW LIMIT'),
name: 'row_limit_b',
popper: t(
'Limits the number of the rows that are computed in the query that is the source of the data used for this chart.',
),
status: 'select',
options: chartFormsOption.row_limit,
},
{
label: t('TRUNCATE METRIC'),
name: 'truncate_metric_b',
status: 'checkbox',
},
],
},
{
collapse_label: t('Advanced analytics Query B '),
collapse_active: 'advanced_b',
collapse_popper: t(
'This section contains options that allow for advanced analytical post processing of query results',
),
forms: [
{
label: t('ROLLING FUNCTION'),
name: 'rolling_type_b',
popper: t(
'Defines a rolling window function to apply, works along with the [Periods] text box',
),
placeholder: t('Select ...'),
status: 'select',
options: chartFormsOption.rolling_type,
},
{
label: t('PERIODS'),
name: 'rolling_periods_b',
popper: t(
'Defines the size of the rolling window function, relative to the time granularity selected',
),
status: 'input',
number: true,
},
{
label: t('MIN PERIODS'),
name: 'min_periods_b',
popper: t(
'The minimum number of rolling periods required to show a value. For instance if you do a cumulative sum on 7 days you may want your "Min Period" to be 7, so that all data points shown are the total of 7 periods. This will hide the "ramp up" taking place over the first 7 periods',
),
status: 'input',
number: true,
},
{
label: t('TIME SHIFT'),
name: 'time_compare_b',
popper: t(
'Overlay one or more timeseries from a relative time period. Expects relative time deltas in natural language (example: 24 hours, 7 days, 52 weeks, 365 days). Free text is supported.',
),
placeholder: t('Select ...'),
status: 'multiple-select',
options: chartFormsOption.time_compare,
},
{
label: t('CALCULATION TYPE'),
name: 'comparison_type_b',
popper: t(
'How to display time shifts: as individual lines; as the difference between the main time series and each time shift; as the percentage change; or as the ratio between series and time shifts.',
),
placeholder: t('Select ...'),
status: 'select',
options: chartFormsOption.comparison_type,
},
{
label: t('RULE'),
name: 'resample_rule_b',
popper: t('Pandas resample rule'),
placeholder: t('Select ...'),
status: 'select',
options: chartFormsOption.resample_rule,
},
{
label: t('FILL METHOD'),
name: 'resample_method_b',
popper: t('Pandas resample method'),
placeholder: t('Select ...'),
status: 'select',
options: chartFormsOption.resample_method,
},
],
},
],
},
];

export default DvtChartData;
84 changes: 84 additions & 0 deletions superset-frontend/src/pages/DvtChart/dvtChartFormPayloads.ts
Original file line number Diff line number Diff line change
Expand Up @@ -606,6 +606,90 @@ const DvtChartFormPayloads: DvtChartFormPayloadsProps[] = [
],
queries: [],
},
{
viz_name: 'mixed_timeseries',
form_data: [
'adhoc_filters',
'adhoc_filters_b',
'annotation_layers',
'color_scheme',
'comparison_type',
'comparison_type_b',
'datasource',
'extra_form_data',
'force',
'groupby',
'groupby_b',
'legendOrientation',
'legendType',
'limit',
'markerSize',
'markerSizeB',
'metrics',
'metrics_b',
'min_periods',
'min_periods_b',
'opacity',
'opacityB',
'order_desc',
'order_desc_b',
'resample_method',
'resample_method_b',
'resample_rule',
'resample_rule_b',
'result_format',
'result_type',
'rich_tooltip',
'rolling_periods',
'rolling_periods_b',
'rolling_type',
'rolling_type_b',
'row_limit',
'row_limit_b',
'series_limit',
'series_limit_b',
'seriesType',
'seriesTypeB',
'show_legend',
'time_compare',
'time_compare_b',
'time_grain_sqla',
'timeseries_limit_metric',
'timeseries_limit_metric_b',
'tooltipTimeFormat',
'truncateXAxis',
'truncate_metric',
'truncate_metric_b',
'url_params',
'viz_type',
'x_axis',
'x_axis_time_format',
'x_axis_title_margin',
'y_axis_bounds',
'y_axis_bounds_secondary',
'y_axis_format',
'y_axis_format_secondary',
'y_axis_title_margin',
'y_axis_title_position',
],
queries: [
'annotation_layers',
'applied_time_extras',
'columns',
'custom_form_data',
'custom_params',
'extras',
'filters',
'metrics',
'orderby',
'post_processing',
'row_limit',
'series_columns',
'series_limit',
'time_offsets',
'url_params',
],
},
];

export default DvtChartFormPayloads;
5 changes: 5 additions & 0 deletions superset-frontend/src/pages/DvtChart/dvtChartSelectBars.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ export const ChartSelectBars: ChartSelectBarProps[] = [
status: 'world_map',
icon: 'dvt-linear_chart',
},
{
popoverLabel: 'Mixed Chart',
status: 'mixed_timeseries',
icon: 'dvt-linear_chart',
},
{
popoverLabel: 'Line Chart',
status: 'echarts_timeseries_line',
Expand Down
Loading
Loading