Skip to Content
DocsπŸ“Š ⏐ ChartsWord Cloud πŸ†•

Word Cloud

A word cloud is a visual representation for text data to visualize keywords or tags. Tags are usually single words, and the importance of each tag is shown with size or color. This format is useful for quickly perceiving the most prominent terms and for locating a term alphabetically to determine its relative prominence.

Quick Start

To create a word cloud, use import the WordCloud and give it some data.

API

WordCloudΒ 

NameTypeDefault
dataChartShallowDataShape[]

Data to render in the word cloud. The β€˜key’ represents the word and β€˜data’ represents its frequency/weight.

[]
fontSizeRange[number, number]

Font size range [min, max].

[12, 50]
fontFamilystring

Font family to use.

'Arial'
paddingnumber

Padding between words.

3
rotationAngles[number, number]

Rotation angles for words.

[-30, 30]
rotationsnumber

Number of possible rotations.

2
colorSchemestring[]

Custom color scheme for words.

schemes.cybertron
onLabelClick(event: MouseEvent<Element, MouseEvent>, data: ChartShallowDataShape) => void

Event triggered when a word is clicked.

onLabelMouseEnter(event: PointerEvent<Element>, data: ChartShallowDataShape) => void

Mouse enter handler.

onLabelMouseLeave(event: PointerEvent<Element>, data: ChartShallowDataShape) => void

Mouse leave handler.

idstring

Id of the chart.

widthnumber

Width of the chart. If not provided will autosize.

heightnumber

Height of the chart. If not provided will autosize.

marginsMargins

Margins for the chart.

classNamestring

Classnames for the chart.

containerClassNamestring

Classnames for the chart.

styleStyleHTMLAttributes<SVGSVGElement>

Additional css styles.

centerboolean

Center the chart. Used mainly internally.

centerXboolean

Center chart on X Axis only. Used mainly internally.

centerYboolean

Center chart on Y Axis only. Used mainly internally.

WordCloudLabelΒ 

NameTypeDefault
textstring

Text to display.

fontSizenumber

Font size in pixels.

fontFamilystring

Font family to use.

fillstring

Fill color for the text.

xnumber

X position of the text.

ynumber

Y position of the text.

rotatenumber

Rotation angle in degrees.

dataChartShallowDataShape

Original data point.

classNamestring

Additional className to apply.

tooltipReactElement<ChartTooltipProps, FC<Partial<ChartTooltipProps>>> | null

Tooltip element.

`<ChartTooltip />`
onClick(event: MouseEvent<Element, MouseEvent>, data: ChartShallowDataShape) => void

Click handler.

onMouseEnter(event: PointerEvent<Element>, data: ChartShallowDataShape) => void

Mouse enter handler.

onMouseLeave(event: PointerEvent<Element>, data: ChartShallowDataShape) => void

Mouse leave handler.

Last updated on