mirror of
https://github.com/apache/superset.git
synced 2024-09-19 20:19:37 -04:00
feat(plugin-chart-word-cloud): allow minimum size (#487)
* feat(plugin-chart-word-cloud): allow minimum size * fix: type * fix: test
This commit is contained in:
parent
caf9a4000e
commit
3364f0f6da
@ -16,7 +16,14 @@ function getMetricLabel(metric: LegacyWordCloudFormData['metric']): string | und
|
||||
|
||||
export default function transformProps(chartProps: ChartProps): WordCloudProps {
|
||||
const { width, height, formData, queryData } = chartProps;
|
||||
const { colorScheme, metric, rotation, series, sizeTo } = formData as LegacyWordCloudFormData;
|
||||
const {
|
||||
colorScheme,
|
||||
metric,
|
||||
rotation,
|
||||
series,
|
||||
sizeFrom = 0,
|
||||
sizeTo,
|
||||
} = formData as LegacyWordCloudFormData;
|
||||
|
||||
const metricLabel = getMetricLabel(metric);
|
||||
|
||||
@ -34,7 +41,7 @@ export default function transformProps(chartProps: ChartProps): WordCloudProps {
|
||||
: {
|
||||
field: metricLabel,
|
||||
scale: {
|
||||
range: [0, sizeTo],
|
||||
range: [sizeFrom, sizeTo],
|
||||
zero: true,
|
||||
},
|
||||
type: 'quantitative',
|
||||
|
@ -5,5 +5,6 @@ export type LegacyWordCloudFormData = QueryFormData & {
|
||||
colorScheme: string;
|
||||
rotation?: RotationType;
|
||||
series: string;
|
||||
sizeFrom?: number;
|
||||
sizeTo: number;
|
||||
};
|
||||
|
@ -37,7 +37,7 @@ describe('WordCloud tranformProps', () => {
|
||||
fontSize: {
|
||||
field: 'sum__num',
|
||||
scale: {
|
||||
range: [0, 70],
|
||||
range: [10, 70],
|
||||
zero: true,
|
||||
},
|
||||
type: 'quantitative',
|
||||
|
Loading…
Reference in New Issue
Block a user