mirror of
https://github.com/apache/superset.git
synced 2024-09-12 00:29:39 -04:00
fix(word cloud): series label format fixed for custom sql queries (#23517)
This commit is contained in:
parent
de42c11f99
commit
41ad9442c0
@ -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,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -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;
|
||||||
};
|
};
|
||||||
|
@ -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;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user