Treemap

Obsolete template

Updated 6 months ago by Flourish team

How to use this template

This template has been superseded by the Hierarchy template. We strongly recommend you use that instead.

Data requirements

The data should be in 'long-form' i.e. each row represents a single data-point and each column represents a variable. For example:

Film                     Genre      Studio         Worldwide Gross ($m)
27 Dresses               Comedy     Fox            160.31
(500) Days of Summer     Comedy     Fox            60.72
A Dangerous Method       Drama      Independent    8.97
A Serious Man            Drama      Universal      30.68
Across the Universe      Romance    Independent    29.37
Beginners                Comedy     Independent    14.31
Dear John                Drama      Sony           114.97

Usage

Columns can be seen as either categorical (e.g. Genre and Studio) or numeric (e.g. Worldwide Gross).

Choose:

  • categorical columns to nest your data by
  • numeric columns to size the rectangles by

For example, if we wanted to know which studio took the most revenue we could nest by Studio and size by Worldwide Gross.

If we wanted to further break down each studio into genres, we could nest by Studio and Genre.

If 2 or more columns are chosen to nest you'll be able to zoom into a category by clicking. Zoom out by clicking the triangle that appears in the top right of the chart.

Examples

Tips

  • You don't have to choose a column to size by, in which case the rectangles will be size by the count of data points.
  • Click on the popup to freeze it. Click on it again to unfreeze.
  • You can choose the number of visible hierarchy levels. Try varying this within a story to gradually break down categories into sub-categories.
  • You can also add a filter option. To do this, set the "Filter" column in the data bindings.

Credits

Created by Peter Cook and the Flourish team.

API information

Explains to developers how to use this template with the Flourish Live API.

template: _606

version: _6

Header

header_title string

Title.

header_subtitle string

Subtitle.

header_color color

Color.

header_align string

Alignment.

Allowed values:

  • left (fa-align-left)
  • center (fa-align-center)
  • right (fa-align-right)

header_margin number

Margin.

header_margin_advanced boolean

Advanced margin settings.

header_margin_top number

Top.

header_margin_right number

Right.

header_margin_bottom number

Bottom.

header_margin_left number

Left.

filter_type string

Control type.

Allowed values:

  • auto (Auto)
  • dropdown (Dropdown menu)
  • slider (Slider)
  • grouped-buttons (Button group)
  • floating-buttons (Buttons)

filter_width number

Width.

controls_padding number

Margin.

filter_include_all boolean

Include “All” option.

filter_all_label string

“All” label.

Treemap

palette string

Colour scheme or custom colours. Choose from the list or enter a custom palette as a comma-separated list of colour codes or names (e.g. red, #343434)

Predefined values:

  • flourish_default_1 (Flourish categories A)
  • flourish_default_2 (Flourish categories B)
  • carto_pastel (Pastel light)
  • carto_antique (Pastel dark)
  • carto_rainbow (Rainbow)
  • schemeCategory20 (20 colours (paired))

aggregation_type string

Size cells by.

Allowed values:

  • Sum (Sum)
  • Count (Count)

treemap_type string

Layout mode.

Allowed values:

  • treemapBinary (Default)
  • treemapResquarify (Aspect ratio)
  • treemapSlice (Horizontal)
  • treemapDice (Vertical)
  • treemapSliceDice (Horizontal then Vertical)

treemap_ratio number

Target. The target ratio between width and height, where 1 is sqaure and a large number is a tall or wide rectangle

Min: 1

cellPadding string

Padding. Add padding between hierarchy levels

Allowed values:

  • low (Thin)
  • medium (Medium)
  • high (Thick)

num_of_visible_levels number

Visible Levels. How many hierarchy levels are visible at once?

Min: 1

Popups

show_popups boolean

Show popups.

Text colour.

Fill colour.

Fill opacity.

Title separator.

Font size.

Min: 1

Prefix.

Decimal places.

Suffix.

Animations

animation_duration number

Duration. In seconds

Footer

Source name.

Source url.

Multiple sources.

Source name.

Source url.

Source name.

Source url.

Change source label.

Source label.

Note.

Size.

Color.

Alignment.

Allowed values:

  • left (fa-align-left)
  • center (fa-align-center)
  • right (fa-align-right)

Overall.

Top.

Right.

Bottom.

Left.

Advanced.