Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 3 commits into from
Mar 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -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,
},
Expand All @@ -68,7 +69,7 @@ export default function transformProps(chartProps: ChartProps): WordCloudProps {
type: 'quantitative',
},
text: {
field: series,
field: seriesLabel,
},
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};