ChartPolarBar
Nightingale-rose (polar bar) chart. N data points are rendered as radial wedges each occupying an equal angular slice; outer radius is proportional to value. Ideal for cyclical data such as hours per day or monthly activity.
Structure
Anatomie
Décomposition visuelle de la structure interne du composant avec les appels de classes BEM.
<origam-chart-polar-bar> — 6 internal parts. Wedges ④ are SVG <path> elements inside a centred <g>. Category labels ⑤ and optional value labels ⑥ float outside / inside the outer radius.- 1.origam-chart-polar-bar
- Root wrapper. CSS grid: header / body / legend rows.
- 2.origam-chart-polar-bar__header
- Optional title + subtitle block.
- 3.origam-chart-polar-bar__body
- Plot area containing the SVG and empty-state slot.
- 4.origam-chart__polar-bar-wedge
- SVG
arc for one data point. Keyboard-focusable (role="button", tabindex="0"). Gets --active modifier on hover. - 5.origam-chart__polar-bar-category-label
- Category text anchored outside the outer radius. text-anchor driven by wedge midpoint quadrant.
- 6.origam-chart__polar-bar-value-label
- Optional numeric value label inside the wedge. Hidden when angular space is insufficient (showValueLabel flag).
API
Props
Toutes les props acceptées par ce composant, avec leur type, valeur par défaut et description.
- innerRadiusnumber0.1
- Fraction of the total radius reserved as a centre hole. 0 = no hole, 1 = zero-thickness ring.
- startAnglenumber0
- Start angle in radians for the first wedge. 0 = 3 o'clock; -Math.PI/2 = 12 o'clock.
- gapnumber0.02
- Angular gap between consecutive wedges in radians. 0 = flush wedges.
- maxValuenumber
- Override the auto-computed maximum used to scale wedge outer radii. When omitted, max(series[0].data) is used.
- showLabelbooleantrue
- Render category labels outside the outer radius of each wedge.
- showValuebooleanfalse
- Render the numeric value label inside the wedge when there is sufficient angular room.
- xAxisFormat(value: string | number) => string
- Formatter applied to tooltip X label (category name or index).
- yAxisFormat(value: number) => string
- Formatter applied to tooltip Y value and the in-wedge value label.
- seriesrequisArray<IChartSeries>—
- Data series. series[0].data is an array of N numeric values, one per radial wedge.
- categoriesArray<string>[]
- Category labels for each wedge. Falls back to numeric index.
- titlestring
- Optional title rendered above the chart area.
- subtitlestring
- Optional subtitle rendered below the title.
- showLegendbooleantrue
- Toggle the legend block.
- legendPositionTChartLegendPosition'bottom'
- Anchor of the legend block: top, bottom, left or right.
- showTooltipbooleantrue
- Toggle the hover tooltip.
- animatedbooleantrue
- Animate wedges on first paint. Respects prefers-reduced-motion.
- animationDurationnumber600
- Animation duration in milliseconds.
- Palette cycled by wedge index when no per-series colour is set.
- aspectRatiostring
- CSS aspect-ratio shortcut. Overrides height when set.
- idstring
- classstring | Array<string> | object
- stylestring | Array<string> | object | StyleValue
- heightnumber | string
- Chart wrapper height. Accepts CSS length or 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 colour of the chart wrapper.
- fontSizeTFontSize
- fontWeightTFontWeight
API
Slots
Emplacements de contenu exposés par ce composant.
- #tooltip
- Replace the default tooltip body. Receives the hovered point, the category label, and the pre-computed percentage string.
- #legend-item
- Replace one legend entry with custom content.
- #title
- Replace the default title + subtitle block.
- #empty
- Rendered when series is empty or all series have no data.
API
Emits
Événements émis par ce composant.
- @point-clickIChartPoint, MouseEvent | KeyboardEvent
- Fired on mouse click or keyboard activation (Enter/Space) on a wedge.
- @legend-clickIChartSeries, number
- Fired when the user clicks a legend entry.
- @series-toggleIChartSeries, boolean
- Resulting visibility flip after a legend click.
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.
- Background colour of the chart wrapper.
- Default text colour (inherited by category labels).
- Inner padding of the root wrapper.
- Grid gap between header / body / legend rows.
- Wedge animation duration. Set via animationDuration prop.
- Tooltip background colour.
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 between focusable wedges (tabindex="0" on each <path>). |
| Enter / Space | Activates the focused wedge (fires point-click). |
Notes
- Root div carries role="figure" and aria-label from the title prop (or "Polar bar chart").
- Inner SVG has role="img" with <title> and <desc> elements summarising the data.
- Each wedge <path> has aria-label with category, value, percentage and series name.
- All CSS 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.
- colorvar(--origam-color__surface---default)
- Chart wrapper background.
- colorvar(--origam-color__surface---inverse)
- Tooltip background colour.
- dimensionvar(--origam-space---3)
- Gap between legend items.
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.
Weekly activity — nightingale rose
With centre hole