Chart
Universal chart component with 29 visualization primitives (line, area, bar, column, pie, donut, scatter, radar, gauge, pyramid, funnel, honeycomb, treemap, sankey, word-cloud, heatmap, sunburst, box-plot, pictorial, candlestick, streamgraph, variwide, polar-bar, bullet, pareto, map, sparkline, spline, stepped-line). The type prop routes to the appropriate family member.
Structure
Anatomie
Décomposition visuelle de la structure interne du composant avec les appels de classes BEM.
<origam-chart> — 5 visible regions; the component delegates rendering to the appropriate family member based on the type prop.- 1.origam-chart
- Root element. Delegates to the correct family component (cartesian/polar/radar/gauge/pyramid…).
- 2.origam-chart__title
- Title and subtitle block rendered above the plotting area.
- 3.origam-chart__axis
- X and Y axes with tick labels. Rendered by OrigamChartAxis. Hidden when showAxis=false.
- 4.origam-chart__legend
- Legend block. Rendered by OrigamChartLegend. Position controlled by legendPosition prop.
- 5.origam-chart__plot
- SVG plotting area where series paths, bars or slices are drawn.
API
Props
Toutes les props acceptées par ce composant, avec leur type, valeur par défaut et description.
- Visualization primitive. Accepted values: 'line' | 'area' | 'bar' | 'column' | 'pie' | 'donut' | 'scatter' | 'radar' | 'spline' | 'stepped-line' | 'gauge' | 'pyramid' | 'funnel' | 'honeycomb' | 'treemap' | 'sankey' | 'word-cloud' | 'heatmap' | 'sunburst' | 'box-plot' | 'pictorial' | 'candlestick' | 'streamgraph' | 'variwide' | 'polar-bar' | 'bullet' | 'pareto' | 'map' | 'sparkline'.
- seriesrequisArray<IChartSeries>[]
- Data series array. An empty array renders the #empty slot. Each series contains name, data, color and visible.
- categoriesArray<string>[]
- X-axis category labels. Length should match the longest series; missing entries fall back to the numeric index.
- titlestring
- Optional title rendered above the plotting area.
- subtitlestring
- Optional subtitle rendered below the title.
- showLegendbooleantrue
- Toggle the legend block.
- Anchor of the legend block. Accepted: 'top' | 'bottom' | 'left' | 'right'.
- showTooltipbooleantrue
- Toggle the hover tooltip.
- showGridbooleantrue
- Render grid lines behind the plot. Ignored for pie/donut/radar.
- showAxisbooleantrue
- Render X/Y axes and tick labels. Ignored for pie/donut.
- animatedbooleantrue
- Animate paths/bars/slices on first paint. Respects prefers-reduced-motion.
- animationDurationnumber600
- Animation duration in ms.
- stackedbooleanfalse
- Stack series on bar/column charts.
- Stacking mode when stacked=true. 'normal' = absolute values, 'percent' = 0-100% normalised.
- donutHoleSizenumber0.6
- Inner-radius proportion for donut type. 0 = pie, 1 = ring of zero thickness. Default 0.6 when type=donut.
- Palette cycled when a series has no explicit color. Accepts intent names or raw CSS colours.
- xAxisFormat(value: string | number) => string
- Formatter function applied to X-axis tick labels.
- yAxisFormat(value: number) => string
- Formatter function applied to Y-axis tick labels.
- aspectRatiostring
- CSS aspect-ratio shortcut ('16/9', '4/3', '1/1'…). When set, overrides height.
- Smoothing strategy for line/area. 'none' = Cartesian segments, 'curve' = cubic Bezier (Catmull-Rom).
- yMinnumber
- Override the auto-computed Y minimum.
- yMaxnumber
- Override the auto-computed Y maximum.
- gaugeMinnumber0
- Lower bound of the gauge range. Ignored unless type=gauge.
- gaugeMaxnumber100
- Upper bound of the gauge range. Ignored unless type=gauge.
- gaugeUnitstring''
- Unit suffix appended to the gauge centre label (e.g. "%").
- plotBandsArray<IChartPlotBand>
- plotLinesArray<IChartPlotLine>
- annotationsArray<IChartAnnotation>
- drilldownIChartDrilldownProps
- secondaryYAxisIChartSecondaryYAxis
- idstring
- classstring | Array<string> | object
- stylestring | Array<string> | object | StyleValue
- heightnumber | string300
- Chart height in pixels or a CSS length.
- maxHeightnumber | string
- maxWidthnumber | string
- minHeightnumber | string
- minWidthnumber | string
- widthnumber | string
- Explicit width override. Defaults to 100% of the 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 color of the chart container.
API
Slots
Emplacements de contenu exposés par ce composant.
- #tooltip
- Replace the default tooltip body with a custom component.
- #legend-item
- Replace one legend entry. Receives series data, its index and current visibility.
- #title
- Replace the title and subtitle block entirely.
- #empty
- Rendered when series is empty or every series is hidden.
API
Emits
Événements émis par ce composant.
- @point-clickIChartPoint, MouseEvent | KeyboardEvent
- Mouse or keyboard activation on a data point.
- @legend-clickIChartSeries, number
- Click on a legend entry. Pair with series-toggle to manage visibility state.
- @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.
- Chart container background colour.
- Default text colour for title, labels and legend.
- Inner padding of the chart container.
- Title text colour.
- Title font size.
- Axis line colour.
- Grid line colour.
- Tooltip background colour.
- Stroke width of line/area series paths.
- Animation duration for enter/update transitions.
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 to interactive data points (when keyboard navigation is enabled). |
| Enter / Space | Fires point-click emit on a focused data point. |
Notes
- The animated prop respects prefers-reduced-motion: reduce — set animated=false or let the component detect the system preference.
- Use colorScheme to provide intent-based colours with sufficient contrast for all colour-vision deficiency profiles. Avoid relying solely on hue to distinguish series — use dashed/solid patterns or labels when possible.
- The #empty slot provides a meaningful message when no data is available, ensuring screen reader users are not left with a silent chart container.
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 container background.
- dimensionvar(--origam-font__size---lg)
- Title font size.
- colorvar(--origam-color__border---subtle)
- Grid line colour.
- colorvar(--origam-color__surface---inverse)
- Tooltip background.
- dimension2px
- Line/area stroke width.
- duration600ms
- Enter/update animation duration.
- dimensionvar(--origam-radius---xs)
- Bar/column corner radius.
- number0.18
- Radar polygon fill opacity.
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.
Line chart
Donut chart
Gauge chart
Écosystème
Famille
Composants du même dossier qui partagent les conventions et se composent souvent ensemble.
ChartCartesian
Cartesian chart engine: line, area, bar, column, scatter, spline, stepped-line.
ChartPolar
Polar chart engine: pie, donut.
ChartRadar
Radar (spider) chart engine.
ChartGauge
Gauge / speedometer chart engine.
ChartPyramid
Pyramid and funnel chart engine.
ChartHoneycomb
Hexagonal honeycomb chart engine.
ChartTreemap
Treemap chart engine.
ChartSankey
Sankey flow diagram engine.
ChartWordCloud
Word cloud engine.
ChartHeatmap
Heatmap matrix engine.
ChartSunburst
Sunburst radial tree engine.
ChartBoxPlot
Box-and-whisker plot engine.
ChartPictorial
Pictorial bar chart (icon-filled bars) engine.
ChartCandlestick
OHLC candlestick chart engine.
ChartStreamgraph
Streamgraph stacked area engine.
ChartVariwide
Variable-width column (Marimekko) engine.
ChartPolarBar
Polar bar / rose chart engine.
ChartBullet
Bullet chart (target vs. actual) engine.
ChartPareto
Pareto chart (bars + cumulative line) engine.
ChartMap
Choropleth / geo map engine.
ChartSparkline
Inline mini sparkline engine.
ChartAxis
Axis and tick rendering sub-component.
ChartLegend
Legend block sub-component.
ChartTooltip
Tooltip overlay sub-component.
ChartRangeSelector
Interactive range selector sub-component.