From 41ad9442c07690786b8b398b91f07df6235812e3 Mon Sep 17 00:00:00 2001 From: ashgorithm <30403195+ashgorithm@users.noreply.github.com> Date: Thu, 30 Mar 2023 14:34:57 +0530 Subject: [PATCH] fix(word cloud): series label format fixed for custom sql queries (#23517) --- .../src/legacyPlugin/transformProps.ts | 7 ++++--- .../plugin-chart-word-cloud/src/legacyPlugin/types.ts | 4 ++-- .../plugins/plugin-chart-word-cloud/src/types.ts | 4 ++-- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/superset-frontend/plugins/plugin-chart-word-cloud/src/legacyPlugin/transformProps.ts b/superset-frontend/plugins/plugin-chart-word-cloud/src/legacyPlugin/transformProps.ts index aec557d616..0b5a36b999 100644 --- a/superset-frontend/plugins/plugin-chart-word-cloud/src/legacyPlugin/transformProps.ts +++ b/superset-frontend/plugins/plugin-chart-word-cloud/src/legacyPlugin/transformProps.ts @@ -17,7 +17,7 @@ * under the License. */ -import { ChartProps } from '@superset-ui/core'; +import { ChartProps, getColumnLabel } from '@superset-ui/core'; import { WordCloudProps, WordCloudEncoding } from '../chart/WordCloud'; import { LegacyWordCloudFormData } from './types'; @@ -47,10 +47,11 @@ export default function transformProps(chartProps: ChartProps): WordCloudProps { } = formData as LegacyWordCloudFormData; const metricLabel = getMetricLabel(metric); + const seriesLabel = getColumnLabel(series); const encoding: Partial = { color: { - field: series, + field: seriesLabel, scale: { scheme: colorScheme, }, @@ -68,7 +69,7 @@ export default function transformProps(chartProps: ChartProps): WordCloudProps { type: 'quantitative', }, text: { - field: series, + field: seriesLabel, }, }; diff --git a/superset-frontend/plugins/plugin-chart-word-cloud/src/legacyPlugin/types.ts b/superset-frontend/plugins/plugin-chart-word-cloud/src/legacyPlugin/types.ts index 6101d14a0f..2cdc348126 100644 --- a/superset-frontend/plugins/plugin-chart-word-cloud/src/legacyPlugin/types.ts +++ b/superset-frontend/plugins/plugin-chart-word-cloud/src/legacyPlugin/types.ts @@ -17,13 +17,13 @@ * under the License. */ -import { QueryFormData } from '@superset-ui/core'; +import { QueryFormColumn, QueryFormData } from '@superset-ui/core'; import { RotationType } from '../chart/WordCloud'; export type LegacyWordCloudFormData = QueryFormData & { colorScheme: string; rotation?: RotationType; - series: string; + series: QueryFormColumn; sizeFrom?: number; sizeTo: number; }; diff --git a/superset-frontend/plugins/plugin-chart-word-cloud/src/types.ts b/superset-frontend/plugins/plugin-chart-word-cloud/src/types.ts index 324db12778..fef33bb56c 100644 --- a/superset-frontend/plugins/plugin-chart-word-cloud/src/types.ts +++ b/superset-frontend/plugins/plugin-chart-word-cloud/src/types.ts @@ -17,12 +17,12 @@ * under the License. */ -import { QueryFormData } from '@superset-ui/core'; +import { QueryFormColumn, QueryFormData } from '@superset-ui/core'; import { WordCloudVisualProps } from './chart/WordCloud'; // FormData for wordcloud contains both common properties of all form data // and properties specific to wordcloud visualization export type WordCloudFormData = QueryFormData & WordCloudVisualProps & { - series: string; + series: QueryFormColumn; };