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.
*/
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<WordCloudEncoding> = {
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,
},
};

View File

@ -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;
};

View File

@ -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;
};