feat: add Advanced Analytics into mixed time series chart (#19851)

This commit is contained in:
Yongjie Zhao
2022-04-27 23:36:19 +08:00
committed by GitHub
parent 795da71751
commit f5e9f0eb3b
7 changed files with 503 additions and 72 deletions

View File

@@ -18,10 +18,12 @@
*/
import React from 'react';
import { t } from '@superset-ui/core';
import { cloneDeep } from 'lodash';
import {
ControlPanelConfig,
ControlPanelSectionConfig,
ControlSetRow,
CustomControlItem,
emitFilterControl,
sections,
sharedControls,
@@ -253,11 +255,33 @@ function createCustomizeSection(
];
}
function createAdvancedAnalyticsSection(
label: string,
controlSuffix: string,
): ControlPanelSectionConfig {
const aaWithSuffix = cloneDeep(sections.advancedAnalyticsControls);
aaWithSuffix.label = label;
if (!controlSuffix) {
return aaWithSuffix;
}
aaWithSuffix.controlSetRows.forEach(row =>
row.forEach((control: CustomControlItem) => {
if (control?.name) {
// eslint-disable-next-line no-param-reassign
control.name = `${control.name}${controlSuffix}`;
}
}),
);
return aaWithSuffix;
}
const config: ControlPanelConfig = {
controlPanelSections: [
sections.legacyTimeseriesTime,
createQuerySection(t('Query A'), ''),
createAdvancedAnalyticsSection(t('Advanced analytics Query A'), ''),
createQuerySection(t('Query B'), '_b'),
createAdvancedAnalyticsSection(t('Advanced analytics Query B'), '_b'),
{
label: t('Annotations and Layers'),
expanded: false,