Skip to Content

TreeMap

A TreeMap in REAVIZ displays hierarchical data as a set of nested rectangles. Each branch of the tree is given a rectangle, which is then tiled with smaller rectangles representing sub-branches. The area of each leaf node’s rectangle is proportional to a specified data dimension, and the color often represents a separate data dimension.

Where to use:

  • Visualize Hierarchical Data: Ideal for displaying hierarchical data structures.
  • Show Proportional Values: Useful for showing how different parts of a whole compare in size.
  • Highlight Data Dimensions: Great for highlighting multiple data dimensions, such as size and color.

Quick Start

To create a treemap chart, use import the TreeMap and give it data. The chart will automatically configure itself with the default options exposed via props.

Examples

API

TreeMapΒ 

NameTypeDefault
dataChartShallowDataShape[] | ChartNestedDataShape[]

Data the chart will receive to render.

[]
seriesReactElement<TreeMapSeriesProps, FC<Partial<TreeMapSeriesProps>>>

The series component that renders the components.

`<TreeMapSeries />`
paddingInnernumber

Inner padding for the treemap.

5
paddingOuternumber

Outer padding for the treemap.

5
paddingTopnumber

Padding top for the treemap. This is used for the title spacing in nested situations.

30
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.

TreeMapSeriesΒ 

NameTypeDefault
idstring

Id set by the parent.

dataany[]

The internal data object built by d3

animatedboolean

Whether the chart is animated or not.

true
colorSchemeColorSchemeType

Color scheme for the chart.

'cybertron'
rectReactElement<TreeMapRectProps, FC<Partial<TreeMapRectProps>>>

Rect element to be rendered.

`<TreeMapRect />`
labelReactElement<TreeMapLabelProps, FC<Partial<TreeMapLabelProps>>>

Label element to be rendered.

`<TreeMapLabel />`

TreeMapLabelΒ 

NameTypeDefault
idstring

Id set by the parent.

dataany

The internal data object built by d3

fontSizenumber

Font size of the text.

14
fontFamilystring

Font family of the text.

'sans-serif'
fillstring

Fill of the text.

'#FFF'
wrapboolean

Should wrap text or not.

true
placement"start" | "middle" | "end"

Placement of the text.

'start'

TreeMapRectΒ 

NameTypeDefault
dataany

The internal data object built by d3

idstring

Id set by the parent.

fillstring

Fill for the rect.

animatedboolean

Whether the chart is animated or not.

cursorstring

Cursor for the element.

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

Tooltip element.

`<ChartTooltip />`
onClick(event: any, data: any) => void

Event for when the arc is clicked.

onMouseEnter(event: any, data: any) => void

Event for when the arc has mouse enter.

onMouseLeave(event: any, data: any) => void

Event for when the arc has mouse leave.

Last updated on