Skip to content

Commit

Permalink
fix(wordCloud): save local variable to avoid repeat compute
Browse files Browse the repository at this point in the history
  • Loading branch information
skie1997 authored and xile611 committed Aug 3, 2023
1 parent 789d559 commit 9173ca0
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/vgrammar-wordcloud/src/wordcloud.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,10 @@ export const transform = (
// 只有fontSize不为固定值时,fontSizeRange才生效
if (fontSizeRange && !isNumber(fontSize)) {
const fsize: any = fontSize;
fontSize = datum => generateSqrtScale(extent(fsize, data), fontSizeRange as number[])(fsize(datum));
fontSize = datum => {
const fontSizeSqrtScale = generateSqrtScale(extent(fsize, data), fontSizeRange as number[]);
return fontSizeSqrtScale(fsize(datum));
};
}

let Layout: any = CloudLayout;
Expand Down

0 comments on commit 9173ca0

Please sign in to comment.