Skip to content

Radial Tree API

A radial cluster()/dendrogram: groups fan out from a centre point, leaves land on the SAME radius as every other leaf - see the Radial Tree demo.

Import

ts
import "@michi-vz/wc/radial-tree-chart";
// <michi-vz-radial-tree-chart> is now defined
ts
import { mountRadialTreeChart } from "@michi-vz/core";

const chart = mountRadialTreeChart(el, props);

Props

PropTypeDefaultDescription
timelineboolean | TimelinePeriodConfig-Opt-in "play through years": snapshots one period at a time over the period tags in the data, with a headless controller (`chart.timeline()`) plus the built-in play button + scrubber. Values tween between periods unless `interpolate: false`. Off by default; wins over `progressiveDraw` when both are set.
progressiveDrawboolean | ProgressiveDrawConfig-Opt-in reveal animation: wipes the marks in left to right on mount (a clip reveal; axes and titles stay put). `true` uses defaults (1200 ms, easeInOutCubic); a config tunes durationMs, easing, autoplay, and replayOnUpdate (`tipLabel` is LineChart-only and ignored here). Off by default; respects prefers-reduced-motion (renders fully drawn instantly) and `replay()` re-runs it.
dataSet*RadialTreeNode[]-Forest of nodes (each a leaf or a group with children), laid out as a radial dendrogram.
centerLabelstring-Optional word-wrapped title drawn inside the small centre circle (legacy `titleCenter`).
titlestring-Optional chart title rendered above the plot
radiusRange[number, number]DEFAULT_RADIUS_RANGE[min, max] circle radius in px (default [2, 32], the legacy `circleRange`).
labelDensityThresholds{ rotateAbove?: number; hideAbove?: number }-Adaptive label density thresholds, compared against the total LEAF count. `rotateAbove` (default 20): past this many leaves, every label is abbreviated and rotated radially instead of kept horizontal. `hideAbove` (default 100): past this many leaves, all labels are hidden.
isLoadingboolean-Show the loading overlay and skip the no-data check (legacy michi-vz parity).
isNodataboolean | ((dataSet: RadialTreeNode[] | null | undefined) => boolean)-No-data override: boolean, or a predicate on dataSet; default = empty dataSet.
noDataLabelstring-Text for the vanilla default no-data overlay (ignored when suppressed).
suppressDefaultOverlayboolean-A framework wrapper sets this to render its OWN loading/no-data node instead.
tooltipFormatter(d: RadialTreeNode) => string-Returns custom tooltip HTML for a hovered node (sanitized before it is inserted)
onHighlightItem(labels: string[]) => void-Called when the hovered/highlighted label(s) change
Common props - shared by every chart (14)
PropTypeDefaultDescription
widthnumber900Chart width in pixels
heightnumber520Chart height in pixels
marginMargin{ top: 36, right: 10, bottom: 10, left: 10 }Inner margins (top/right/bottom/left, in px) reserved for axes, titles, and labels
colorsstring[]-Categorical palette for series/labels without an explicit colour or colorsMapping entry
colorsMappingRecord<string, string>-Explicit label -> colour map; takes precedence over the palette and per-item colours
highlightItemsstring[]-Labels to emphasise; all other marks dim
disabledItemsstring[]-Labels to hide and exclude from scales/stacks
renderer"svg" | "canvas" | "webgpu""svg"Render as inline SVG (default) or to a canvas (faster for large datasets); getContext() is identical either way
localestring-BCP-47 locale used for number and date formatting
skipColorMappingDispatchbooleanfalseExternal-CSS mode: unmapped labels resolve to transparent and onColorMappingGenerated is not emitted, so mark colours come from your CSS via the data-label-safe contract
enableTransitionsbooleantrueAnimate updates with CSS transitions (default true)
onColorMappingGenerated(mapping: Record<string, string>) => void-Called with the resolved label -> colour map after the chart assigns colours
onChartDataProcessed(context: ChartContext) => void-Called with the renderer-agnostic ChartContext whenever the data is (re)processed
onDataWarning(warnings: DataWarning[]) => void-Called with any non-fatal data warnings (duplicate labels, non-finite values, non-monotonic dates, ...)

Events

The web component dispatches these bubbling CustomEvents (the engine exposes the same via the on* callbacks in the table above):

EventDetailFires when
michi-vz:highlightstring[]hover highlight changes
michi-vz:colormappingRecord<string, string>a color mapping is generated
michi-vz:dataprocessedChartContextdata is (re)processed
michi-vz:datawarningDataWarning[]input warnings are detected (empty groups, negative/non-finite values, duplicate labels, nesting deeper than 2 levels)

getContext()

mountRadialTreeChart(el, props).getContext() returns a renderer-agnostic RadialTreeChartContext: stats.leafCount / groupCount / grandTotal / min (the smallest leaf) / max (the biggest leaf) / maxDepth, a nodes[] array (one row per node - group AND leaf - with label, code, color, depth, isLeaf, value, path), a deterministic natural-language summary, and an a11yTable. See LLM context.

Source

Props are typed as RadialTreeChartProps in @michi-vz/core.