treemap
Configuration Structure
treemap: {}plotOptions
enabled
trueParent containers appear on their own as soon as the data carries children. Set false to force the flat two-level layout regardless.
Available Options:
- true (default)
- false
drilldownAsLevels
falseRead drilldown: '<id>' ids as extra levels of the hierarchy instead of as a click target for the drilldown feature.
Defaults to false, because on a treemap that id has always meant "descend on click".
Available Options:
- true
- false (default)
parents
How a branch is drawn once the data is nested: the header strip, its label and padding. Accepts the same shape as a level. Per-depth overrides go in levels.
show
'auto'Whether branch containers are drawn.
Available Options:
- 'auto' (default): on when the data carries
children. - true
- false
formatter
Custom tooltip for a branch. Receives { name, value, depth, leafCount, percentOfParent, percentOfTotal, node, w } and returns an HTML string.
A branch's tooltip is its own element, beside the leaf tooltip, with the same classes plus apexcharts-treemap-tooltip, so CSS written for the chart's tooltip styles it too, and .apexcharts-treemap-tooltip targets branches alone.
percentOfParent and percentOfTotal are the two questions a nested treemap actually raises, so they are passed rather than left to be derived.
levels
Per-depth overrides of parents, indexed from the outermost group actually drawn (0 = the series, or the first authored level when a single series is unwrapped).
enableShades
trueEnable different shades of color depending on the value
shadeIntensity
0.5The intensity of the shades generated for each value
Accepts from 0 to 1
reverseNegativeShade
trueWhen enabled, it will reverse the shades for negatives but keep the positive shades as it is now. An example of such use-case would be in a profit/loss chart where darker reds mean larger losses, darker greens mean larger gains.
distributed
falseWhen turned on, each series in a treemap will have it's own lowest and highest range and colors will be shaded for each series. Default value is false.
useFillColorAsStroke
falseWhen turned on, the stroke/border around the treemap cell has the same color as the cell color.
borderRadius
0Rounds the corners of every treemap tile. Set to 0 for square corners.
seriesTitle
Header label rendered at the top of each series' treemap region. Useful in multi-series treemaps to identify which group each tile cluster belongs to.
show
Show or hide the series title bar.
offsetX
Left offset for the series title.
offsetY
Top offset for the series title.
borderColor
Border color around the series title.
borderWidth
Border width around the series title.
borderRadius
Border radius applied to the corners of the series title background.
style
Text styling for the series title.
background
Background color of the series title bar.
color
Text color of the series title.
fontSize
Font size of the series title.
fontFamily
Font family of the series title.
fontWeight
Font weight of the series title.
cssClass
Optional CSS class added to the series title element for custom styling.
padding
Padding applied around the series title text.
left
Left padding of the series title.
right
Right padding of the series title.
top
Top padding of the series title.
bottom
Bottom padding of the series title.
dataLabels
format
You can either set the labels to scale based on the box size, or you can keep the same font-dize and let the labels truncate if they exceed the area. Below are the available options:
- scale
- truncate
colorScale
ranges
from
Value indicating range's upper limit
to
Value indicating range's lower limit
color
Background color to fill the range with.
foreColor
Fore Color of the text if data-labels is enabled.
inverse
In a multiple series treemap, flip the color-scale to fill the treemaps vertically instead of horizontally.
min
Specify the lower range for treemap color calculation.
max
Specify the higher range for treemap color calculation.
name
Label for this range in the legend. Without it the range is shown by its bounds.
colorValue
Colour a tile by a second metric, independent of the value that sizes it: area is how big something is, colour is how it did.
Reads datum.colorValue by default. Pass a key name to read a different property, or an accessor to compute one.
colorValue: function(datum, { seriesIndex, dataPointIndex, w }) { return datum.growth }
gradient
Continuous interpolation between colour stops for the metric above, instead of the discrete buckets ranges gives.
Active as soon as any datum carries a colour metric. enabled: false opts out and true forces it on. ranges is unaffected and still applies wherever it is set.
gradientLegend
Continuous colour legend for that metric: a gradient strip with end labels and a hover indicator, shown in place of the categorical legend.
minFontSize
Skip a tile's label when it would render below this size in pixels. Defaults to 4; set 0 to label every tile regardless.
This is a performance control as much as a visual one. With format: 'scale' the font size follows the tile's area, so a dense treemap asks for a lot of text only a few pixels tall, and each label still has to be built and measured against the DOM. On a large chart that measurement dominates the render.
zoom
Click a group to fill the canvas with it, with a breadcrumb back.
Ignored when the drilldown feature is active on the same chart: both navigate the hierarchy, and drilldown owns the click there.
padding
Inset between a parent's edge and the children inside it. Defaults to 4.
fillOpacity
Opacity of the container fill.
borderColor
Border color of the container.
borderWidth
Border width of the container.
borderRadius
Corner radius of the container. Falls back to plotOptions.treemap.borderRadius.
hover
Outline drawn on the container on hover: { show, color, width }. show defaults to true.
header
The strip at the top of a container carrying the branch's name.
Accepts show, height (default 22), minWidth (default 40, below which the strip is skipped because no name could be read anyway), align, offsetX, offsetY, showValue to append the branch's aggregate, a formatter, and a style block.
padding
Per-depth override of parents.padding.
fillOpacity
Per-depth override of parents.fillOpacity.
borderColor
Per-depth override of parents.borderColor.
borderWidth
Per-depth override of parents.borderWidth.
borderRadius
Per-depth override of parents.borderRadius.
hover
Per-depth override of parents.hover.
header
Per-depth override of parents.header. Indexed from the outermost group actually drawn, so levels[0] is the series, or the first authored level when a single series is unwrapped.
enabled
Force the gradient on or off. It is already active whenever a datum carries a colour metric, so this is only needed to opt out.
min
Domain low. Defaults to the extent of the colour metric.
max
Domain high. Defaults to the extent of the colour metric.
midpoint
The value the middle colour is pinned to. Defaults to 0 when the domain straddles zero, which is the diverging case. Pass null to force a plain sequential ramp.
symmetric
With a midpoint, balance the domain around it so equal moves in either direction read as equally saturated. Defaults to true.
stops
Explicit stops as { value, color }. Overrides colors and midpoint.
enabled
Show the gradient strip instead of the categorical legend.
width
Strip length for horizontal placements (top and bottom). A number is pixels, a percentage string resolves against the chart's SVG width. Defaults to '70%'.
height
Strip length for vertical placements (left and right), resolved against the SVG height. Defaults to '70%'.
thickness
Strip thickness on its short axis, in pixels. Defaults to 12.
align
Strip alignment within the legend area. Defaults to 'center'.
Available Options:
- start: left for top/bottom placements, top for left/right
- center (default)
- end: right for top/bottom placements, bottom for left/right
stops
Number of colour stops sampled from the shade function when no explicit ranges or continuous scale supply their own. Defaults to 16.
showLabels
Show min and max labels at the ends of the strip. Defaults to true.
showHoverValue
Show a value tooltip next to the arrow when a mark is hovered. Defaults to true.
labelStyle
Styling for the end labels: { fontSize, fontFamily, colors }.
arrow
The hover indicator that tracks along the strip: { size, color }.
formatter
Formats the min and max labels and the hover value tooltip. Receives the value and returns the string to show.
enabled
Enable click-to-zoom into a group.
breadcrumb
Overrides drilldown.breadcrumb for this chart only, so a zoomed treemap and a drilled-in chart present the same affordance without importing the drilldown feature.
show
Outline the container on hover. Defaults to true.
color
Colour of the hover outline.
width
Width of the hover outline.
show
Draw the header strip on the container.
height
Height of the strip reserved at the top of the container. Defaults to 22.
minWidth
Skip the strip on tiles narrower than this, where no name could be read anyway. Defaults to 40.
align
Horizontal alignment of the header text: 'left', 'center' or 'right'.
offsetX
Sets the left offset of the header text.
offsetY
Sets the top offset of the header text.
showValue
Append the branch's aggregate to its name. Defaults to false.
formatter
Formats the header text. Receives the branch name and { value, depth, seriesIndex, node, w }.
formatter: function(name, { value, depth }) { return depth === 0 ? name.toUpperCase() : name }
style
Header text styling: { fontSize, fontFamily, fontWeight, color, background, cssClass }.
show
Per-depth override of parents.hover.show.
color
Per-depth override of parents.hover.color.
width
Per-depth override of parents.hover.width.
show
Per-depth override of parents.header.show.
height
Per-depth override of parents.header.height.
minWidth
Per-depth override of parents.header.minWidth.
align
Per-depth override of parents.header.align.
offsetX
Per-depth override of parents.header.offsetX.
offsetY
Per-depth override of parents.header.offsetY.
showValue
Per-depth override of parents.header.showValue.
formatter
Per-depth override of parents.header.formatter.
style
Per-depth override of parents.header.style.
value
Value this stop is pinned to.
color
Colour at this stop.
size
Size of the hover indicator, in pixels.
color
Colour of the hover indicator.
fontSize
Font size of the end labels.
fontFamily
Font family of the end labels.
fontSize
Font size of the header text.
fontFamily
Font family of the header text.
fontWeight
Font weight of the header text.
color
Colour of the header text.
background
Background colour of the header strip.
cssClass
Extra CSS class on the header text element.
fontSize
Per-depth override of parents.header.style.fontSize.
fontFamily
Per-depth override of parents.header.style.fontFamily.
fontWeight
Per-depth override of parents.header.style.fontWeight.
color
Per-depth override of parents.header.style.color.
background
Per-depth override of parents.header.style.background.
cssClass
Per-depth override of parents.header.style.cssClass.
show
Show the breadcrumb. Same shape as drilldown.breadcrumb.show, which this overrides for the treemap only.
position
Where to place it: 'top-left' or 'top-right'. Same shape as drilldown.breadcrumb.position, which this overrides for the treemap only.
separator
String drawn between crumbs. Same shape as drilldown.breadcrumb.separator, which this overrides for the treemap only.
rootLabel
Label of the leftmost crumb, the "everything" level. Defaults to All. Same shape as drilldown.breadcrumb.rootLabel, which this overrides for the treemap only.
offsetX
Sets the left offset of the breadcrumb. Same shape as drilldown.breadcrumb.offsetX, which this overrides for the treemap only.
offsetY
Sets the top offset of the breadcrumb. Same shape as drilldown.breadcrumb.offsetY, which this overrides for the treemap only.
formatter
Formats one crumb. Receives the label and { index, depth, data }. Same shape as drilldown.breadcrumb.formatter, which this overrides for the treemap only.