fix(word cloud): series label format fixed for custom sql queries (#23517)

This commit is contained in:
ashgorithm 2023-03-30 14:34:57 +05:30 committed by GitHub
parent de42c11f99
commit 41ad9442c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 7 deletions

View File

@ -17,7 +17,7 @@
* under the License. * under the License.
*/ */
import { ChartProps } from '@superset-ui/core'; import { ChartProps, getColumnLabel } from '@superset-ui/core';
import { WordCloudProps, WordCloudEncoding } from '../chart/WordCloud'; import { WordCloudProps, WordCloudEncoding } from '../chart/WordCloud';
import { LegacyWordCloudFormData } from './types'; import { LegacyWordCloudFormData } from './types';
@ -47,10 +47,11 @@ export default function transformProps(chartProps: ChartProps): WordCloudProps {
} = formData as LegacyWordCloudFormData; } = formData as LegacyWordCloudFormData;
const metricLabel = getMetricLabel(metric); const metricLabel = getMetricLabel(metric);
const seriesLabel = getColumnLabel(series);
const encoding: Partial<WordCloudEncoding> = { const encoding: Partial<WordCloudEncoding> = {
color: { color: {
field: series, field: seriesLabel,
scale: { scale: {
scheme: colorScheme, scheme: colorScheme,
}, },
@ -68,7 +69,7 @@ export default function transformProps(chartProps: ChartProps): WordCloudProps {
type: 'quantitative', type: 'quantitative',
}, },
text: { text: {
field: series, field: seriesLabel,
}, },
}; };

View File

@ -17,13 +17,13 @@
* under the License. * under the License.
*/ */
import { QueryFormData } from '@superset-ui/core'; import { QueryFormColumn, QueryFormData } from '@superset-ui/core';
import { RotationType } from '../chart/WordCloud'; import { RotationType } from '../chart/WordCloud';
export type LegacyWordCloudFormData = QueryFormData & { export type LegacyWordCloudFormData = QueryFormData & {
colorScheme: string; colorScheme: string;
rotation?: RotationType; rotation?: RotationType;
series: string; series: QueryFormColumn;
sizeFrom?: number; sizeFrom?: number;
sizeTo: number; sizeTo: number;
}; };

View File

@ -17,12 +17,12 @@
* under the License. * under the License.
*/ */
import { QueryFormData } from '@superset-ui/core'; import { QueryFormColumn, QueryFormData } from '@superset-ui/core';
import { WordCloudVisualProps } from './chart/WordCloud'; import { WordCloudVisualProps } from './chart/WordCloud';
// FormData for wordcloud contains both common properties of all form data // FormData for wordcloud contains both common properties of all form data
// and properties specific to wordcloud visualization // and properties specific to wordcloud visualization
export type WordCloudFormData = QueryFormData & export type WordCloudFormData = QueryFormData &
WordCloudVisualProps & { WordCloudVisualProps & {
series: string; series: QueryFormColumn;
}; };