ChartPolar
Polar chart (pie / donut) with animated slices, interactive legend, tooltip, and optional drilldown navigation.
Aperçu
Rendu de l’aperçu en cours…
pieStructure
Anatomie
Décomposition visuelle de la structure interne du composant avec les appels de classes BEM.
<origam-chart-polar> — 5 internal parts. The SVG body hosts the pie/donut slices; the legend and tooltip sit outside the SVG.- 1.origam-chart-polar
- Root element. CSS Grid with named areas: header / breadcrumb / body / legend.
- 2.origam-chart-polar__header
- Title + subtitle block. Rendered only when title or subtitle is set. Houses the #title slot.
- 3.origam-chart-polar__svg
- SVG canvas. role="img" with <title> and
for screen reader accessibility. Slices are keyboard-focusable elements with role="button". - 4.origam-chart-polar__empty
- Absolutely positioned empty state overlay. Shown when series is empty or all series are hidden.
- 5.origam-chart-polar__breadcrumb
API
Props
Toutes les props acceptées par ce composant, avec leur type, valeur par défaut et description.
- typeTChartPolarKind'pie'
- Polar visualisation primitive. pie = filled slices; donut = ring with a centre hole.
- donutHoleSizenumber0.6
- Inner-radius fraction for type=donut. 0 = no hole, 1 = zero-thickness ring. Ignored for type=pie.
- showTooltipbooleantrue
- Toggle the hover tooltip.
- xAxisFormat(value: string | number) => string
- Formatter applied to the tooltip X label (category name or index).
- yAxisFormat(value: number) => string
- Formatter applied to the tooltip Y value.
- drilldownIChartDrilldownProps
- Drilldown configuration. When provided, slices with a drilldown link trigger chart-level navigation with a breadcrumb nav.
- seriesrequisArray<IChartSeries>—
- Data series. Each series contains a name, optional color and a data array. Empty array renders the #empty slot.
- categoriesArray<string>[]
- Labels for each data point. Used in the legend and tooltip.
- titlestring
- Optional chart title rendered above the plotting area.
- subtitlestring
- Optional subtitle rendered below the title.
- showLegendbooleantrue
- Toggle the legend block.
- legendPositionTChartLegendPosition'bottom'
- Anchor position of the legend relative to the chart body.
- animatedbooleantrue
- Animate slices on first paint. Respects prefers-reduced-motion.
- animationDurationnumber600
- Animation duration in milliseconds.
- Custom colour palette cycled across slices when a series has no pinned color.
- aspectRatiostring
- CSS aspect-ratio shortcut (e.g. "1/1"). When set, overrides the height prop.
- idstring
- classstring | Array<string> | object
- stylestring | Array<string> | object | StyleValue
- heightnumber | string300
- Chart container height. Accepts a CSS length or a number (px).
- maxHeightnumber | string
- maxWidthnumber | string
- minHeightnumber | string
- minWidthnumber | string
- widthnumber | string
- marginboolean | number | string
- marginTopboolean | number | string
- marginLeftboolean | number | string
- marginBottomboolean | number | string
- marginRightboolean | number | string
- marginBlockboolean | number | string
- marginInlineboolean | number | string
- marginInlineStartboolean | number | string
- marginInlineEndboolean | number | string
- marginBlockStartboolean | number | string
- marginBlockEndboolean | number | string
- paddingboolean | number | string
- paddingTopboolean | number | string
- paddingLeftboolean | number | string
- paddingBottomboolean | number | string
- paddingRightboolean | number | string
- paddingBlockboolean | number | string
- paddingInlineboolean | number | string
- paddingInlineStartboolean | number | string
- paddingInlineEndboolean | number | string
- paddingBlockStartboolean | number | string
- paddingBlockEndboolean | number | string
- roundedboolean | number | string | TRounded | null | undefined
- roundedTopRightboolean | number | string
- roundedTopLeftboolean | number | string
- roundedBottomLeftboolean | number | string
- roundedBottomRightboolean | number | string
- roundedStartStartboolean | number | string
- roundedStartEndboolean | number | string
- roundedEndStartboolean | number | string
- roundedEndEndboolean | number | string
- elevationTElevation
- bgColor
- Background color of the chart container.
- fontSizeTFontSize
- fontWeightTFontWeight
API
Slots
Emplacements de contenu exposés par ce composant.
- #tooltip
- Custom tooltip content. Receives the hovered point, series and category.
- #legend-item
- Custom legend item renderer.
- #title
- Replaces the default title/subtitle header block.
- #empty
- Shown when series is empty or all data is hidden. Defaults to "No data to display".
API
Emits
Événements émis par ce composant.
- @drillIChartDrilldownLink, IChartPoint
- Fired when the user drills into a sub-dataset via a drilldown link.
- @drill-upvoid
- Fired when the user navigates back one drilldown level.
- @point-clickIChartPoint, MouseEvent | KeyboardEvent
- Fired when a slice is clicked or activated via keyboard. Carries the point data and the triggering event.
- @legend-clickIChartSeries, number
- Fired when the user clicks a legend item.
- @series-toggleIChartSeries, boolean
- Fired when a series visibility is toggled via the legend. Second arg is the next visible state.
Personnalisation
Variables CSS
Propriétés CSS personnalisées exposées par ce composant. Surchargez-les pour personnaliser sans perdre la compatibilité avec le thème.
- Gap between the header, body, and legend grid areas.
- Padding of the root container.
- Background color of the chart container.
- Controls the slice fade-in animation duration. Set by the animationDuration prop.
- Stroke color between pie/donut slices (gap line).
- Stroke width between slices in SVG units.
Inclusion
Accessibilité
Rôles ARIA, navigation clavier et gestion du focus. Sourcé depuis le template réel du composant.
Rôles ARIA
Interactions clavier
| Touche | Action |
|---|---|
| Tab | Moves focus across the interactive slices (each <path> has tabindex="0"). |
| Enter / Space | Activates the focused slice (fires point-click or triggers drilldown). |
Notes
- The SVG carries role="img" with a <title> and <desc> generated from the series data. Screen readers announce the chart as a single image with a summary.
- Each slice has tabindex="0" and role="button" with an aria-label formatted as "{category}: {value}".
- Slice animations are disabled under prefers-reduced-motion: reduce.
Fondation
Design tokens
Extrait des tokens de ce composant — les variables --origam-<composant>---<propriété>, déclarées dans sa feuille de tokens tenue à la main, sans étape de build.
- dimensionvar(--origam-space---3)
- Gap between grid areas (header / body / legend).
- dimensionvar(--origam-space---3)
- Padding of the chart container.
Interactif
Playground
Modifiez les props en direct et observez le composant se mettre à jour. Le snippet de code généré suit vos changements.
Rendu de l’aperçu en cours…
Usage
Exemples
Extraits de code prêts à coller dans vos templates.
Pie chart
Donut chart
Écosystème
Famille
Composants du même dossier qui partagent les conventions et se composent souvent ensemble.