Skip to content

Commit

Permalink
fix: create scale ordinal outside of the fill function
Browse files Browse the repository at this point in the history
  • Loading branch information
chentsulin committed Sep 19, 2021
1 parent f65da05 commit 497416f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/WordCloud.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ type WordCloudProps = {
onWordMouseOut?: () => void;
};

const defaultScaleOrdinal = scaleOrdinal(schemeCategory10);

function WordCloud({
data,
width = 700,
Expand All @@ -55,7 +57,7 @@ function WordCloud({
random = Math.random,
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore The ordinal function should accept number
fill = (_, i) => scaleOrdinal(schemeCategory10)(i),
fill = (_, i) => defaultScaleOrdinal(i),
onWordClick,
onWordMouseOver,
onWordMouseOut,
Expand Down

0 comments on commit 497416f

Please sign in to comment.