Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ for more detailed props, please refer to below:
| data | The words array | `{ text: string, value: number }>[]` | ✓ |
| width | Width of the layout (px) | `number` | | `700` |
| height | Height of the layout (px) | `number` | | `600` |
| timeInterval | The maximum amount of time that can be spent during the current timestep (ms). Prevents the layout from getting stuck. | `number` | | `Infinity` |
| font | The font accessor function, which indicates the font face for each word. A constant may be specified instead of a function. | `string \| (d) => string` | | `'serif'` |
| fontStyle | The fontStyle accessor function, which indicates the font style for each word. A constant may be specified instead of a function. | `string \| (d) => string` | | `'normal'` |
| fontWeight | The fontWeight accessor function, which indicates the font weight for each word. A constant may be specified instead of a function. | `string \| number \| (d) => string \| number` | | `'normal'` |
Expand Down
6 changes: 6 additions & 0 deletions src/WordCloud.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ type WordCloudProps = {
data: Datum[];
width?: number;
height?: number;
timeInterval?: number;
font?: string | ((word: Word, index: number) => string);
fontStyle?: string | ((word: Word, index: number) => string);
fontWeight?:
Expand All @@ -46,6 +47,7 @@ function WordCloud({
data,
width = 700,
height = 600,
timeInterval,
font = 'serif',
fontStyle = 'normal',
fontWeight = 'normal',
Expand Down Expand Up @@ -130,6 +132,10 @@ function WordCloud({
}
});

if (timeInterval) {
layout.timeInterval(timeInterval);
}

layout.start();

return el.toReact();
Expand Down