diff --git a/superset-frontend/packages/superset-ui-chart-controls/src/sections/annotationsAndLayers.tsx b/superset-frontend/packages/superset-ui-chart-controls/src/sections/annotationsAndLayers.tsx index 9fffbb578e4d1..6db4abad683ae 100644 --- a/superset-frontend/packages/superset-ui-chart-controls/src/sections/annotationsAndLayers.tsx +++ b/superset-frontend/packages/superset-ui-chart-controls/src/sections/annotationsAndLayers.tsx @@ -24,6 +24,7 @@ export const annotationLayers = []; export const annotationsAndLayersControls: ControlPanelSectionConfig = { label: t('Annotations and Layers'), expanded: false, + tabOverride: 'data', controlSetRows: [ [ { @@ -33,6 +34,7 @@ export const annotationsAndLayersControls: ControlPanelSectionConfig = { label: '', default: annotationLayers, description: t('Annotation Layers'), + renderTrigger: true, }, }, ], diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/MixedTimeseries/controlPanel.tsx b/superset-frontend/plugins/plugin-chart-echarts/src/MixedTimeseries/controlPanel.tsx index e39c023661696..8566fa599921c 100644 --- a/superset-frontend/plugins/plugin-chart-echarts/src/MixedTimeseries/controlPanel.tsx +++ b/superset-frontend/plugins/plugin-chart-echarts/src/MixedTimeseries/controlPanel.tsx @@ -35,7 +35,6 @@ import { legendSection, richTooltipSection, xAxisControl } from '../controls'; const { area, - annotationLayers, logAxis, markerEnabled, markerSize, @@ -289,23 +288,7 @@ const config: ControlPanelConfig = { 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, - controlSetRows: [ - [ - { - name: 'annotation_layers', - config: { - type: 'AnnotationLayerControl', - label: '', - default: annotationLayers, - description: t('Annotation Layers'), - }, - }, - ], - ], - }, + sections.annotationsAndLayersControls, sections.titleControls, { label: t('Chart Options'), diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/MixedTimeseries/transformProps.ts b/superset-frontend/plugins/plugin-chart-echarts/src/MixedTimeseries/transformProps.ts index 10dd33ff1ac4e..139dcd9af70ce 100644 --- a/superset-frontend/plugins/plugin-chart-echarts/src/MixedTimeseries/transformProps.ts +++ b/superset-frontend/plugins/plugin-chart-echarts/src/MixedTimeseries/transformProps.ts @@ -81,9 +81,8 @@ export default function transformProps( filterState, datasource, theme, + annotationData = {}, } = chartProps; - const { annotation_data: annotationData_ } = queriesData[0]; - const annotationData = annotationData_ || {}; const { verboseMap = {} } = datasource; const data1 = (queriesData[0].data || []) as TimeseriesDataRecord[]; const data2 = (queriesData[1].data || []) as TimeseriesDataRecord[]; diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/transformProps.ts b/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/transformProps.ts index 8b91308b20469..db142c8aa2875 100644 --- a/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/transformProps.ts +++ b/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/transformProps.ts @@ -86,13 +86,12 @@ export default function transformProps( queriesData, datasource, theme, + annotationData = {}, } = chartProps; const { verboseMap = {} } = datasource; const [queryData] = queriesData; - const { annotation_data: annotationData_, data = [] } = - queryData as TimeseriesChartDataResponseResult; + const { data = [] } = queryData as TimeseriesChartDataResponseResult; const dataTypes = getColtypesMapping(queryData); - const annotationData = annotationData_ || {}; const { area, diff --git a/superset-frontend/plugins/plugin-chart-echarts/test/Timeseries/transformProps.test.ts b/superset-frontend/plugins/plugin-chart-echarts/test/Timeseries/transformProps.test.ts index 3fbe72e59ad12..172ce24204218 100644 --- a/superset-frontend/plugins/plugin-chart-echarts/test/Timeseries/transformProps.test.ts +++ b/superset-frontend/plugins/plugin-chart-echarts/test/Timeseries/transformProps.test.ts @@ -180,54 +180,54 @@ describe('EchartsTimeseries transformProps', () => { ...formData, annotationLayers: [event, interval, timeseries], }, - queriesData: [ - { - ...queriesData[0], - annotation_data: { - 'My Event': { - columns: [ - 'start_dttm', - 'end_dttm', - 'short_descr', - 'long_descr', - 'json_metadata', - ], - records: [ - { - start_dttm: 0, - end_dttm: 1000, - short_descr: '', - long_descr: '', - json_metadata: null, - }, - ], + annotationData: { + 'My Event': { + columns: [ + 'start_dttm', + 'end_dttm', + 'short_descr', + 'long_descr', + 'json_metadata', + ], + records: [ + { + start_dttm: 0, + end_dttm: 1000, + short_descr: '', + long_descr: '', + json_metadata: null, }, - 'My Interval': { - columns: ['start', 'end', 'title'], - records: [ - { - start: 2000, - end: 3000, - title: 'My Title', - }, - ], + ], + }, + 'My Interval': { + columns: ['start', 'end', 'title'], + records: [ + { + start: 2000, + end: 3000, + title: 'My Title', }, - 'My Timeseries': [ + ], + }, + 'My Timeseries': [ + { + key: 'My Line', + values: [ + { + x: 10000, + y: 11000, + }, { - key: 'My Line', - values: [ - { - x: 10000, - y: 11000, - }, - { - x: 20000, - y: 21000, - }, - ], + x: 20000, + y: 21000, }, ], }, + ], + }, + queriesData: [ + { + ...queriesData[0], }, ], });