ChartPareto
Pareto chart combining vertical bars sorted descending by value with a cumulative percentage line on a secondary right Y-axis. Ideal for 80/20 rule and root-cause analysis.
Structure
Anatomie
Décomposition visuelle de la structure interne du composant avec les appels de classes BEM.
<origam-chart-pareto> — 8 internal parts. The SVG occupies __body; bars ④, line ⑤ and dots ⑥ are SVG children. Axes ⑦⑧ flank the plot area.- 1.origam-chart-pareto
- Root wrapper. CSS grid: header / body / legend rows.
- 2.origam-chart-pareto__header
- Optional title + subtitle block (grid-area: header). Hidden when neither title nor subtitle is set.
- 3.origam-chart-pareto__body
- Plot area (grid-area: body). Contains the SVG and the empty-state slot.
- 4.origam-chart-pareto__bar
- One
per datum, sorted descending. Keyboard-focusable (role="button", tabindex="0"). - 5.origam-chart-pareto__line
- SVG
tracing the cumulative percentage. Conditionally rendered when showLine=true. - 6.origam-chart-pareto__line-dot
- Circle markers on the cumulative line, one per bar centre.
- 7.origam-chart-pareto__axis--x
- X-axis line + category tick marks and labels.
- 8.origam-chart-pareto__axis--y-left / --y-right
- Left Y-axis (values) and right Y-axis (cumulative %). Conditionally rendered when showLine=true.
API
Props
Toutes les props acceptées par ce composant, avec leur type, valeur par défaut et description.
- Colour of all bars. Accepts a TIntent token or a raw CSS colour.
- Colour of the cumulative percentage line.
- barGapnumber4
- Gap in SVG pixels between adjacent bars.
- showLinebooleantrue
- Toggle the cumulative percentage line overlay.
- showLabelbooleanfalse
- Show a value label above each bar.
- showAxisbooleantrue
- Render the X (category) and Y (value + %) axes.
- showGridbooleantrue
- Render horizontal grid lines aligned with Y-axis ticks.
- xAxisFormat(value: string | number) => string
- Formatter applied to X-axis category tick labels.
- yAxisFormat(value: number) => string
- Formatter applied to the left Y-axis value tick labels.
- cumulativeFormat(value: number) => string
- Formatter for the right Y-axis cumulative % ticks. Defaults to rounded integer, e.g. "80%".
- seriesrequisArray<IChartSeries>—
- Data series. series[0].data must be an array of IChartParetoDatum ({ category, value }). Auto-sorted descending before rendering.
- categoriesArray<string>[]
- Optional category labels (fallback when data items lack a category field).
- titlestring
- Optional title rendered above the chart area.
- subtitlestring
- Optional subtitle rendered below the title.
- showLegendbooleantrue
- Toggle the legend block showing bars and cumulative line entries.
- legendPositionTChartLegendPosition'bottom'
- Anchor of the legend block: top, bottom, left or right.
- showTooltipbooleantrue
- Toggle the hover tooltip.
- animatedbooleantrue
- Animate bars and line on first paint. Respects prefers-reduced-motion.
- animationDurationnumber600
- Animation duration in milliseconds.
- Palette used when a series does not pin its own colour.
- aspectRatiostring
- CSS aspect-ratio shortcut (e.g. "16/9"). Overrides height when set.
- idstring
- classstring | Array<string> | object
- stylestring | Array<string> | object | StyleValue
- heightnumber | string360
- Chart wrapper height. Accepts CSS length or number (→ px).
- maxHeightnumber | string
- maxWidthnumber | string
- minHeightnumber | string
- minWidthnumber | string
- widthnumber | string
- Chart wrapper width. Defaults to 100% of its container.
- 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. Receives the full bar descriptor including share and cumulative percentage.
- #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 bar.
- @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 axis labels).
- Inner padding of the root wrapper.
- Grid gap between header / body / legend rows.
- Duration of bar grow and line-draw animations. Set via animationDuration prop.
- Stroke colour of horizontal grid lines.
- Stroke colour of axis lines and tick marks.
- Font size of X/Y axis tick labels.
- Stroke colour drawn between adjacent bars (typically the background).
- Stroke width of the cumulative percentage line.
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 bars (tabindex="0" on each <rect>). |
| Enter / Space | Activates the focused bar (fires point-click). |
Notes
- Root div carries role="figure" and aria-label from the title prop (or "Pareto chart" as fallback).
- Inner SVG has role="img" with a <title> and <desc> element summarising the data count.
- Each bar <rect> has aria-label describing its category, value, share (%) and cumulative (%).
- 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.
- colorvar(--origam-color__border---default)
- Axis line and tick mark colour.
- colorvar(--origam-color__border---subtle)
- Grid line stroke 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.
Basic Pareto
Bars only (no cumulative line)