Skip to content

API Arbre radial

Un cluster()/dendrogramme radial : les groupes rayonnent depuis un point central, les feuilles atterrissent sur le MÊME rayon que toutes les autres feuilles - voir la démo Arbre radial.

Import

ts
import "@michi-vz/wc/radial-tree-chart";
// <michi-vz-radial-tree-chart> est maintenant défini
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, ...)

Événements

Le web component émet ces CustomEvents qui remontent (bubbling) (le moteur expose les mêmes via les callbacks on* du tableau ci-dessus) :

ÉvénementDétailSe déclenche quand
michi-vz:highlightstring[]le survol change
michi-vz:colormappingRecord<string, string>une correspondance de couleur est générée
michi-vz:dataprocessedChartContextles données sont (re)traitées
michi-vz:datawarningDataWarning[]des avertissements sur les données en entrée sont détectés (groupes vides, valeurs négatives/non finies, labels dupliqués, imbrication au-delà de 2 niveaux)

getContext()

mountRadialTreeChart(el, props).getContext() renvoie un RadialTreeChartContext agnostique du moteur de rendu : stats.leafCount / groupCount / grandTotal / min (la plus petite feuille) / max (la plus grande feuille) / maxDepth, un tableau nodes[] (une ligne par nœud - groupe OU feuille - avec label, code, color, depth, isLeaf, value, path), un summary déterministe en langage naturel, et un a11yTable. Voir Contexte LLM.

Source

Les props sont typées RadialTreeChartProps dans @michi-vz/core.