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 {
|
export default function transformProps(chartProps: ChartProps): WordCloudProps {
|
||||||
const { width, height, formData, queryData } = chartProps;
|
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);
|
const metricLabel = getMetricLabel(metric);
|
||||||
|
|
||||||
@ -34,7 +41,7 @@ export default function transformProps(chartProps: ChartProps): WordCloudProps {
|
|||||||
: {
|
: {
|
||||||
field: metricLabel,
|
field: metricLabel,
|
||||||
scale: {
|
scale: {
|
||||||
range: [0, sizeTo],
|
range: [sizeFrom, sizeTo],
|
||||||
zero: true,
|
zero: true,
|
||||||
},
|
},
|
||||||
type: 'quantitative',
|
type: 'quantitative',
|
||||||
|
@ -5,5 +5,6 @@ export type LegacyWordCloudFormData = QueryFormData & {
|
|||||||
colorScheme: string;
|
colorScheme: string;
|
||||||
rotation?: RotationType;
|
rotation?: RotationType;
|
||||||
series: string;
|
series: string;
|
||||||
|
sizeFrom?: number;
|
||||||
sizeTo: number;
|
sizeTo: number;
|
||||||
};
|
};
|
||||||
|
@ -37,7 +37,7 @@ describe('WordCloud tranformProps', () => {
|
|||||||
fontSize: {
|
fontSize: {
|
||||||
field: 'sum__num',
|
field: 'sum__num',
|
||||||
scale: {
|
scale: {
|
||||||
range: [0, 70],
|
range: [10, 70],
|
||||||
zero: true,
|
zero: true,
|
||||||
},
|
},
|
||||||
type: 'quantitative',
|
type: 'quantitative',
|
||||||
|
Loading…
Reference in New Issue
Block a user