ChartPolar
Polar chart (pie / donut) with animated slices, interactive legend, tooltip, and optional drilldown navigation.
Preview
Rendering the live preview…
pieStructure
Anatomy
Visual breakdown of the component's internal structure with BEM class call-outs.
<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
All props accepted by this component, with their type, default value and 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.
- seriesrequiredArray<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
Content slots exposed by this component.
- #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
Events emitted by this component.
- @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.
Customisation
CSS variables
CSS custom properties exposed by this component. Override them to customise the component without losing theme compatibility.
- 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
Accessibility
ARIA roles, keyboard navigation and focus management. Sourced from the real component template.
ARIA roles
Keyboard interactions
| Key | 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.
Foundation
Design tokens
Excerpt from this component's token declarations — the --origam-<component>---<property> variables, declared in its hand-maintained token sheet with no build step.
- dimensionvar(--origam-space---3)
- Gap between grid areas (header / body / legend).
- dimensionvar(--origam-space---3)
- Padding of the chart container.
Interactive
Playground
Edit props live and see the component update in real time. The generated code snippet updates as you change values.
Rendering the live preview…
Usage
Examples
Ready-to-paste code snippets for your templates.
Pie chart
Donut chart
Ecosystem
Family
Components from the same folder that share conventions and often compose together.