Skip to content
This repository has been archived by the owner on Dec 10, 2021. It is now read-only.

Commit

Permalink
feat(plugin-chart-word-cloud): allow minimum size (#487)
Browse files Browse the repository at this point in the history
* feat(plugin-chart-word-cloud): allow minimum size

* fix: type

* fix: test
  • Loading branch information
kristw authored May 13, 2020
1 parent 9b6d611 commit 356229b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -34,7 +41,7 @@ export default function transformProps(chartProps: ChartProps): WordCloudProps {
: {
field: metricLabel,
scale: {
range: [0, sizeTo],
range: [sizeFrom, sizeTo],
zero: true,
},
type: 'quantitative',
Expand Down
1 change: 1 addition & 0 deletions plugins/plugin-chart-word-cloud/src/legacyPlugin/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ export type LegacyWordCloudFormData = QueryFormData & {
colorScheme: string;
rotation?: RotationType;
series: string;
sizeFrom?: number;
sizeTo: number;
};
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ describe('WordCloud tranformProps', () => {
fontSize: {
field: 'sum__num',
scale: {
range: [0, 70],
range: [10, 70],
zero: true,
},
type: 'quantitative',
Expand Down

1 comment on commit 356229b

@vercel
Copy link

@vercel vercel bot commented on 356229b May 13, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.