Wordcloud Transform

The wordcloud transform computes a word cloud layout, similar to Wordle. The wordcloud transform is intended for visualizing words or phrases with the text mark type. This transform uses Jason Davies’ wordcloud implementation.


In this example, word angles are randomly selected from the set [-rotate, 0, rotate].

Transform Parameters

Property Type Description
font String | Expr The font family to use for a word.
fontStyle String | Expr The font style to use for a word.
fontWeight String | Expr The font weight to use for a word.
fontSize Number | Expr The font size in pixels to use for a word.
fontSizeRange Number[ ] The range of font sizes to use for the words. If the range is specified and the fontSize is not a numeric constant, the fontSize values will automatically be scaled to lie in the range according to a square root scale.
padding Number | Expr The padding in pixels to place around a word.
rotate Number | Expr The angle in degrees to use for a word.
text Field The data field with the word text.
spiral String The spiral layout method used to place words. One of archimedean (the default) or rectangular.
as String[ ] The output fields written by the transform. The default is ["x", "y", "font", "fontSize", "fontStyle", "fontWeight", "angle"]

Note: The wordcloud layout requires that text marks have an align value of "center" and a baseline value of "alphabetic". If other settings are used, the text positioning will be inaccurate.


  "type": "wordcloud",
  "size": [{"signal": "width"}, {"signal": "height"}],
  "text": {"field": "text"},
  "font": "Helvetica Neue",
  "fontSize": {"field": "count"},
  "fontWeight": {"field": "weight"},
  "fontSizeRange": [10, 56],
  "rotate": {"field": "angle"},
  "padding": 2

Computes a wordcloud layout using the full width and height of the view. The fontSize, fontWeight and rotate parameters are drawn directly from data fields. A fontSizeRange of [10, 56] is used to scale the fontSize values. The results are then written to the default output fields.