Docs
📊 ⏐ Charts
Tree Map

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 (opens in a new tab)

PropDescriptionDefault
dataData the chart will receive to render.
ChartShallowDataShape<ChartDataTypes | [ChartDataTypes, ChartDataTypes]>[] | ChartNestedDataShape[]
[]
seriesThe series component that renders the components.
ReactElement<TreeMapSeriesProps, FC<Partial<TreeMapSeriesProps>>>
<TreeMapSeries />
paddingInnerInner padding for the treemap. Defaults to 5.
number
5
paddingOuterOuter padding for the treemap. Defaults to 5.
number
5
paddingTopPadding top for the treemap. This is used for the title spacing in nested situations. Defaults to 30.
number
30
idId of the chart.
string
widthWidth of the chart. If not provided will autosize.
number
heightHeight of the chart. If not provided will autosize.
number
marginsMargins for the chart.
Margins
0
classNameClassnames for the chart.
string
containerClassNameClassnames for the chart.
string
styleAdditional css styles.
StyleHTMLAttributes<SVGSVGElement>
centerCenter the chart. Used mainly internally.
boolean
centerXCenter chart on X Axis only. Used mainly internally.
boolean
centerYCenter chart on Y Axis only. Used mainly internally.
boolean

TreeMapSeries (opens in a new tab)

PropDescriptionDefault
idId set by the parent.
string
dataThe internal data object built by d3
any[]
animatedWhether the chart is animated or not.
boolean
true
colorSchemeColor scheme for the chart.
ColorSchemeType
cybertron
rectRect element to be rendered.
ReactElement<TreeMapRectProps, FC<Partial<TreeMapRectProps>>>
<TreeMapRect />
labelLabel element to be rendered.
ReactElement<TreeMapLabelProps, FC<Partial<TreeMapLabelProps>>>
<TreeMapLabel />

TreeMapLabel (opens in a new tab)

PropDescriptionDefault
idId set by the parent.
string
dataThe internal data object built by d3
any
fontSizeFont size of the text.
number
14
fontFamilyFont family of the text.
string
sans-serif
fillFill of the text.
string
#FFF
wrapShould wrap text or not.
boolean
true
placementPlacement of the text.
"start" | "middle" | "end"
start

TreeMapRect (opens in a new tab)

PropDescriptionDefault
dataThe internal data object built by d3
any
idId set by the parent.
string
fillFill for the rect.
string
animatedWhether the chart is animated or not.
boolean
cursorCursor for the element.
string
pointer
tooltipTooltip element.
ReactElement<ChartTooltipProps, FC<Partial<ChartTooltipProps>>>
<ChartTooltip />
onClickEvent for when the arc is clicked.
(event: any, data: any) => void
onMouseEnterEvent for when the arc has mouse enter.
(event: any, data: any) => void
onMouseLeaveEvent for when the arc has mouse leave.
(event: any, data: any) => void