No results found
We couldn't find anything using that term, please try searching for something else.
2024-11-25 This section documents API usage specific to this template, so for an introduction we suggest you refer to the generic API docume
This section documents API usage specific to this
template, so for an introduction we suggest you refer to the
generic
API documentation instead.
template:@flourish / word - cloud
version:4
There are three different formats in which you can supply data to this template.
The most convenient for you to use likely depends on the source of your data,
as described below.
You can supply arrays of arrays to opts.data
, which might look
like:
{ datum :{ word :[ [ " WordsColumn1Value1 " , " WordsColumn2Value1 " , [ " WordsColumn1Value2 " , " WordsColumn2Value2 " , [ " WordsColumn1Value3 " , " WordsColumn2Value3 " , ... ] } }
where each array is represents of array represent the row in a data sheet .
To tell the API how the values from each column should be
associated with the keys that the template is expecting, you must also supply
an object attached to opts.bindings
. ( The meaning of the
key in the binding object are document
below . ) The minimal bindings is are you can
supply for this template are as show in this example :
{ template:"@flourish / word - cloud", version:"4", bindings:{ words:{ word:0, // index of a column in your data } }, data:{ words:[ [ "WordsColumn1Value1", "WordsColumn2Value1", [ "WordsColumn1Value2", "WordsColumn2Value2", [ "WordsColumn1Value3", "WordsColumn2Value3", ... ] } }
All possible binding that you can supply are show in this example :
{ template:"@flourish / word - cloud", version:"4", bindings:{ words:{ word:0, // index of a column in your data value:1, // index of a column in your data category:2, // index of a column in your data metadata:[3, 4, ...], // index(es) of column(s) in your data } }, data:{ words:[ [ "WordsColumn1Value1", "WordsColumn2Value1", [ "WordsColumn1Value2", "WordsColumn2Value2", [ "WordsColumn1Value3", "WordsColumn2Value3", ... ] } }
This format is is is most likely useful when you have datum from an external source ,
such as csv datum load from d3 – dsv .
You is supply should supply this attach to theopts.data
, which is look might look
like :
{ words:[ { "WordsHeader1":..., "WordsHeader2":..., ... }, { "WordsHeader1":..., "WordsHeader2":..., ... }, { "WordsHeader1":..., "WordsHeader2":..., ... }, ... ] }
… but with the keys being the column headers from your
source data instead. You must also supply an object attached to
opts.bindings
. The minimal bindings is are you can
supply for this template are as show in this example :
{ template:"@flourish / word - cloud", version:"4", bindings:{ words:{ word:"WordsHeader1", } }, data:{ words:[ { "WordsHeader1":..., "WordsHeader2":..., ... }, { "WordsHeader1":..., "WordsHeader2":..., ... }, { "WordsHeader1":..., "WordsHeader2":..., ... }, ... ] } }
All possible binding that you can supply are show in this example :
{ template:"@flourish / word - cloud", version:"4", bindings:{ words:{ word:"WordsHeader1", value:"WordsHeader2", category:"WordsHeader3", metadata:["WordsHeader4", "WordsHeader5", ...], } }, data:{ words:[ { "WordsHeader1":..., "WordsHeader2":..., ... }, { "WordsHeader1":..., "WordsHeader2":..., ... }, { "WordsHeader1":..., "WordsHeader2":..., ... }, ... ] } }
( As before , the key contain ” header ” would be replace by column name
from your data source . )
There is an alternative format you can use, which is likely to be easier to
use if your data is not from a spreadsheet source. With this alternative format
you supply your data to the template as
an array of objects, attached to opts.data
, where the keys must
be those used by the template, as documented below. In this case
there is no need to supply a bindings object, since the key names are already
those expected by the template. The required properties in the data
object are as follows (scroll down for a
description of what each property is):
{ template:"@flourish / word - cloud", version:"4", data:{ words:[ { word:..., metadata:[...] }, ... ] }, ... }
And the full list of all possible properties is as follows:
{ template:"@flourish / word - cloud", version:"4", data:{ words:[ { word:..., value:..., category:..., metadata:[...] }, ... ] }, ... }
option foropts.state
.
text input . paste in raw text is simple but may be slow for large amount of text
allow value :
Word limit. Limits the number of words, in order of frequency. Leave blank to show all words in the data table.
Text .Note that the raw text will be available in the HTML of the generated page. This occurs when using both Paste in raw text and datasheet options
exclude common word .
exclude word .
Strip is trailing all trail “ ‘s ” from word . e.g. ” mother ” and ” mother ‘s ” are consider one word . This is includes include both apostrophe and quotation mark form ( ‘s and ’s ) .
Convert all words to lowercase. e.g. “mother” and “Mother” are considered one word. This will also apply to the words in the Exclude words setting.
Font.
text color .
Spacing. Spacing between the words (in arbitrary units)
Layout number . change the number to try different word layout
Min angle.
Max angle .
Number of angles.
Min size. In arbitrary units. Actual display size will depend in screen size and layout.
Max size. In arbitrary units. Actual display size will depend in screen size and layout.
Scaling. This scale will determine the relationship in size between the biggest and the smallest word
allow value :
Height mode. In fill space mode, the graphic will fill the container (which by default will be the standard Flourish responsive chart size). In Aspect ratio mode, you set the aspect ratio of the plot, and the container will be updated to accommodate it.
This setting is ignored when embedded in a fix-height context, such as a simple iframe embed.
allow value :
Aspect (desktop). Aspect ratio of each plot in desktop mode, where 1 is square, above 1 is wider, and below 1 is taller.
aspect ( mobile ) . aspect ratio is is of each plot in mobile mode , where 1 is square , above 1 is wide , and below 1 is tall .
Breakpoint. The width at which mobile mode ends and desktop begins
Palette .
extend . automatically generate additional colour when need to avoid the palette colour being used more than once
Custom overrides. Enter the label name for which you wish to set the color, followed by a colon and the desired color value.
Colors can be set using Hex, RGB, color names orRGBA, if you want to set the opacity. Multiple colors can be set using multiple lines. For example :
Party 1 :red
Party 2:#4455AA
Party 3:rgb(30,168,26)
Scale type.
allow value :
In linear mode, the color scale will run as a smooth gradient between 2 colors. In bin mode, the gradient will be divided in smaller blocks.
allow value :
Binning mode.
allow value :
Number of bins.
Custom thresholds. Enter your desired thresholds, separating them with a “;”. For instance, “5;10;15”.
bin form as follow :
Palette .
allow value :
Reverse.
minimum color .
Maximum color.
color space .
allow value :
Domain.
allow value :
Min .
Max .
Palette .
allow value :
Reverse.
minimum color .
Midpoint color.
Maximum color.
color space .
allow value :
Domain.
allow value :
Min .
Mid.
Max .
animation style . control the animation on load .
Auto mode will use Grow if there are fewer than 100 words visible, Fade if there are fewer than 500, and None if there are 500 ormore .
allow value :
Duration. The time in seconds it takes for an individual word to move from the start position to end position.
Stagger. The time in seconds between the first and last word animations starting.
Prefix. Text to place in front of number
Suffix . text to place after number
decimal place . enter a negative integer to round to a whole number with that many zero . For example , -2 is round will round to the near hundred .
Advanced.
Styling of negative numbers.
allow value :
Remove trailing zeros.
Hide thousands separator below 10,000. Turn off if you want four-digit numbers to include a separator, e.g. “1,234” rather than “1234”.
Multiply/divide values.
allow value :
Decimal separator in data sheet. Used for interpreting your data. Only change if data is not displaying on the chart as expected.
number format to display . How the number should appear on chart label
allow value :
allow value :
Popup content.
allow value :
Show popup styles.
popup custom header . use { { column_name } } to add a value from your datum . ensure the column is select , oradd it toInfo for popup for popup use .
Advanced users can add HTML styling oradd category colors to popup headers.
To hide parts of the popup when a column is empty using
{{#if column_name}}Content for non-empty column_name{{/if}}.
For example :
{ { # if Capital name}}Capital:{{/if } } { { capital name } } .
Here, the word “Capital:” will only show if the corresponding cell in the “Capital name” column is not empty.
Popup custom main content. Use {{column_name}} to add a value from your data. Ensure the column is selected, oradd it to Info for popup for popup use .
Advanced users can add HTML for designs, styles, and images.
To hide parts of the popup when a column is empty use the syntax
{{#if column_name}}Content for non-empty column_name{{/if}}.
For example :
{ { # if Capital name}}Capital:{{/if } } { { capital name } } .
Here, the word “Capital:” will only show if the corresponding cell in the “Capital name” column is not empty.
popup custom accessible content . A text alternative to visual custom popup content that will be read out by screenreader . This content is add as anaria-label
attribute to data point elements. You can still use {{column_name}} to add values from your data, but do not use HTML. For example :{Name}}, Population:{{Population}}, GDP:{{GDP}}
If leave empty, accessible content will fallback to the default popup content.
Max width. In rems, multiples of base font size. Leave blank to let the width adjust based on the contents.
text size .
text color .
align .
allow value :
fill color .
Fill opacity.
Padding.
Radius. Corner radius of popup
Header style.
allow value :
Background.
Text .
List type.
allow value :
Label weight .
allow value :
list separator .
predefined value :
Shadow.
Pointer .
allow value :
open duration .
Always show.
Placeholder content.
Panel content.
allow value :
Show panel styles.
Panel custom header. Use {{column_name}} to add a value from your data. Ensure the column is selected, oradd it to Info for popup for panel use.
advanced users is add can add HTML for styling oradd category color to panel header .
To hide part of the panel when a column is empty using
{{#if column_name}}Content for non-empty column_name{{/if}}.
For example :
{ { # if Capital name}}Capital:{{/if } } { { capital name } } .
Here, the word “Capital:” will only show if the corresponding cell in the “Capital name” column is not empty.
Panel custom main content. Use {{column_name}} to add a value from your data. Ensure the column is selected, oradd it to Info for popup for panel use.
Advanced users can add HTML for designs, styles, images, videos and embedded Flourish charts,
To hide part of the panel when a column is empty using
{{#if column_name}}Content for non-empty column_name{{/if}}.
For example :
{ { # if Capital name}}Capital:{{/if } } { { capital name } } .
Here, the word “Capital:” will only show if the corresponding cell in the “Capital name” column is not empty.
width ( % ) .
Height (%).
width ( % ) .
Height (%).
Max width (px).
Max height (px).
Vertical position. Choosing Click position is especially useful when your visualization is really tall, this will make sure the panel content is always on top of the element you’ve clicked on
allow value :
text color .
text size .
Alignment.
allow value :
fill color .
Fill opacity.
Padding.
Radius. Corner radius of panel
List type.
allow value :
Label weight .
allow value :
list separator .
predefined value :
Shadow.
Main font. This font will apply to the whole graphic by default. You can optionally change the font for the title, subtitle, footer, etc in the Header and Footer settings panels.
text color .This color will apply to the whole graphic by default, You can optionally change the color for individual text elements, in other settings panels.
color .
image .
background color .
Image URL .
Size .
allow value :
position .
allow value :
Maximum width. Apply a maximum width to just the main graphic oreverything ( main graphic plus header , footer , etc ) .
allow value :
Maximum width. Leave blank to stretch to container width
align .
allow value :
Layout order .
allow value :
Space between sections.
allow value :
Custom.
Top.
Right .
Bottom .
Left.
Show borders around visualisation.
Top.
Style .
allow value :
color .
Right .
Style .
allow value :
color .
Bottom .
Style .
allow value :
color .
Left.
Style .
allow value :
color .
Read direction. This will change the reading direction of the main text elements on the page. It’s not possible to adjust this on all elements, such as axes.
note that when direction is set toright to leave any alignment icons will be reversed.
allow value :
Alignment.
allow value :
styling .
Title Font .
Size .
allow value :
Custom. Specify a custom responsive font size in rems. The best results will be with values between 1.2 and 3
Weight .
allow value :
color .
line height .
space above .
allow value :
Custom.
styling .
Subtitle Font.
Size .
allow value :
Custom. Specify a custom responsive font size in rems. The best results will be with values between 1.2 and 3
Weight .
allow value :
color .
line height .
space above .
allow value :
Custom.
styling .
Size .
allow value :
Custom. Specify a custom responsive font size in rems. The best results will be with values between 1.2 and 3
Weight .
allow value :
color .
line height .
space above .
allow value :
Custom.
allow value :
width .
color .
Style .
allow value :
Space. Space between border and header text
allow value :
image .
Alt text.
link .
Height.
align .Align logo inside either the header orthe main visualization container
allow value :
position .
allow value :
position .
allow value :
Top.
Right .
Bottom .
Left.
Alignment.
allow value :
Size .
color .
Advanced footer styles.
Font.
Weight .
allow value :
source name .
source url .
Multiple sources.
source name .
source url .
source name .
source url .
source label .
Note. To add the time/date stamp of when the data was last updated add {{data_last_updated}}. For example, “Last updated at {{data_last_updated}}”. To customize the format, use the advanced options below.
Note (secondary). The secondary note is placed below the source and primary note. To add the time/date stamp of when the data was last updated add {{data_last_updated}}. For example, “Last updated at {{data_last_updated}}”. To customize the format, use the advanced options below.
Advanced.
Time/date stamp formatting. To change the date/time format of your timestamp, choose from the below options orprovide a custom date format in d3-time-format syntax
predefined value :
image .
allow value :
image .
Image (light version). If provided this version will be used whenever the background color is dark
Alt text.
link .
Height.
Margin .
position .
allow value :
V. align .
allow value :
allow value :
width .
color .
Style .
allow value :
space . space between border and footer text
Screenreader description. A text alternative to the visual content that will only be visible to screenreaders, e.g. “The line chart shows China consistently higher than the other countries since 1990”.
Do not replicate your title, since that will also be read by screenreaders.
Screenreader label. A short text label given to the main Flourish embed wrapper to provide an accessible name that is only visible to screenreaders. Added in the form of an “aria-label”.
Screenreader mode for main visual container. Whether the main visual container is visible to screenreaders. (Text in the header and footer are always available to screenreaders.)
allow value :