ChartCartesian
Cartesian chart engine with X+Y plotting area. Supports line, area, bar, column, scatter, spline and stepped-line topologies. Includes stacking, drilldown, zoom/pan, secondary Y-axis, plot bands, plot lines and annotations.
Structure
Anatomie
Décomposition visuelle de la structure interne du composant avec les appels de classes BEM.
<origam-chart-cartesian> — 5 internal parts.- 1.origam-chart-cartesian__header
- Header block. Contains title and subtitle divs.
- 2.origam-chart-cartesian__body
- Body container. Wraps the SVG, drilldown breadcrumb and zoom controls.
- 3.origam-chart-cartesian__axis
element holding all axis tick labels and grid lines. - 4.origam-chart__series
container for series path, area fill, or bar/column rects. - 5.origam-chart__legend (via OrigamChartLegend)
- Legend list rendered by OrigamChartLegend. grid-area: legend.
API
Props
Toutes les props acceptées par ce composant, avec leur type, valeur par défaut et description.
- Cartesian visualisation primitive: 'line' | 'area' | 'bar' | 'column' | 'scatter' | 'spline' | 'stepped-line'.
- stackedbooleanfalse
- Stack series on top of each other. Applies to bar, column, and area charts.
- Stacking mode: 'normal' (absolute values) or 'percent' (normalised to 100%).
- Smoothing strategy for line/area/spline. 'none' for line/area, 'monotone' for spline.
- yMinnumber
- Override the auto-computed Y-axis minimum.
- yMaxnumber
- Override the auto-computed Y-axis maximum.
- showGridbooleantrue
- Render grid lines behind the plot.
- showAxisbooleantrue
- Render X and Y axes with tick labels.
- showTooltipbooleantrue
- Toggle the hover tooltip.
- xAxisFormat(value: string | number) => string
- Formatter applied to X-axis tick labels.
- yAxisFormat(value: number) => string
- Formatter applied to Y-axis tick labels.
- secondaryYAxisIChartSecondaryYAxis
- plotBandsArray<IChartPlotBand>
- plotLinesArray<IChartPlotLine>
- drilldownIChartDrilldownProps
- zoomablebooleanfalse
- Enable zoom/pan interactions. Mouse-drag zooms; shift+scroll zooms; ctrl+drag pans. A reset button appears when zoomed.
- zoomResetLabelstring
- rangeSelectorIChartRangeSelector
- annotationsArray<IChartAnnotation>
- seriesrequisArray<IChartSeries>[]
- Data series. Each entry may override type (mix-chart) and yAxis (0=left, 1=right secondary axis).
- categoriesArray<string>
- X-axis labels. Length should match the longest series; missing entries fall back to the numeric index.
- titlestring
- Optional chart title rendered above the plotting area.
- subtitlestring
- Optional subtitle rendered below the title.
- showLegendbooleantrue
- Toggle the legend block.
- Anchor of the legend block: top, bottom, left, right.
- animatedbooleantrue
- Animate series on first paint and data changes. Respects prefers-reduced-motion.
- animationDurationnumber600
- Animation duration in milliseconds.
- Palette used when a series does not pin its own color.
- aspectRatiostring
- CSS aspect-ratio shortcut (e.g. "16/9"). When set, overrides height.
- idstring
- classstring | Array<string> | object
- stylestring | Array<string> | object | StyleValue
- heightnumber | string
- 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
- bgColorTColor
- fontSizeTFontSize
- fontWeightTFontWeight
API
Slots
Emplacements de contenu exposés par ce composant.
- #tooltip
- Replace the default tooltip body.
- #legend-item
- Replace one legend entry.
- #title
- Replace the title block (title + subtitle).
- #empty
- Rendered when series is empty or has no renderable data.
API
Emits
Événements émis par ce composant.
- @drillIChartDrilldownLink, IChartPoint
- Fired when the user drills into a sub-dataset via a drilldown-linked point.
- @drill-upvoid
- Fired when the user navigates back one drilldown level.
- @zoom{ start: number, end: number }
- Fired on every committed zoom. start and end are category indices (inclusive).
- @reset-zoomvoid
- Fired when the user resets the zoom to the full data range.
- @point-clickIChartPoint, MouseEvent | KeyboardEvent
- Fired on mouse click or keyboard activation on a data point.
- @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.
- Chart root background colour.
- Inner padding of the chart root.
- Gap between header, body and legend areas.
- Grid line stroke colour.
- 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 interactive data points and legend entries. |
| Enter / Space | Activates the focused data point and fires point-click. |
Notes
- Root element has role="figure" with aria-label set to the title prop.
- SVG has role="img" with <title> and <desc> elements.
- All 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)
- Root chart background.
- dimensionvar(--origam-space---3)
- Chart inner padding.
- colorvar(--origam-color__border---subtle)
- Grid line colour.
- colorvar(--origam-color__text---secondary)
- Axis tick label colour.
- colorvar(--origam-color__surface---inverse)
- Tooltip background.
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
Stacked column chart
Écosystème
Famille
Composants du même dossier qui partagent les conventions et se composent souvent ensemble.