ChartCandlestick
OHLC candlestick chart engine. Renders one candle per datum — a rectangular body between open and close plus a thin wick from low to high. Bullish (close ≥ open) and bearish candles use distinct intent colours.
Structure
Anatomie
Décomposition visuelle de la structure interne du composant avec les appels de classes BEM.
<origam-chart-candlestick> — 6 internal parts.- 1.origam-chart-candlestick__header
- Header block. Contains the title and subtitle divs. Hidden when both are absent.
- 2.origam-chart-candlestick__body
- Body flex container. Wraps the SVG, tooltip and empty-state overlay.
- 3.origam-chart-candlestick__grid
element holding horizontal Y-tick grid lines. Hidden when showGrid=false. - 4.origam-chart-candlestick__candle
per datum. Contains the wick and body . Keyboard-focusable (tabindex=0, role=button). - 5.origam-chart-candlestick__axis
holding all axis tick labels. Hidden when showAxis=false. - 6.origam-chart__legend (via OrigamChartLegend)
- Legend list rendered by the extracted OrigamChartLegend sub-component. grid-area: legend.
API
Props
Toutes les props acceptées par ce composant, avec leur type, valeur par défaut et description.
- heightnumber | string400
- Chart height. Accepts a number (px) or any CSS length. Overridden by aspectRatio when set.
- Fill colour for bullish candles (close ≥ open). Accepts a TIntent token or any CSS colour.
- Fill colour for bearish candles (close < open). Accepts a TIntent token or any CSS colour.
- candleWidthnumber0.6
- Fraction of the per-slot width occupied by the candle body. Range 0–1.
- wickWidthnumber1
- Wick stroke width in SVG user-units.
- showLegendbooleanfalse
- Toggle the legend. Defaults to false — candlestick charts rarely need a legend.
- showTooltipbooleantrue
- Toggle the hover tooltip.
- showGridbooleantrue
- Render background grid lines.
- showAxisbooleantrue
- Render X and Y axes with tick labels.
- yMinnumber
- Override the auto-computed Y-axis minimum. When omitted, derived from min(low) with 5% padding.
- yMaxnumber
- Override the auto-computed Y-axis maximum. When omitted, derived from max(high) with 5% padding.
- xAxisFormat(value: string | number) => string
- Formatter applied to X-axis (date) tick labels.
- yAxisFormat(value: number) => string
- Formatter applied to Y-axis (price) tick labels.
- stylestring | Array<string> | object | StyleValue
- titlestring
- Optional chart title rendered above the plotting area.
- idstring
- classstring | Array<string> | object
- widthnumber | string
- aspectRatiostring
- CSS aspect-ratio shortcut (e.g. "16/9"). When set, overrides height.
- maxHeightnumber | string
- maxWidthnumber | string
- minHeightnumber | string
- minWidthnumber | string
- bgColorTColor
- roundedboolean | number | string | TRounded | null | undefined
- elevationTElevation
- paddingboolean | number | string
- marginboolean | number | string
- fontSizeTFontSize
- fontWeightTFontWeight
- 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
- 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
- roundedStartStartboolean | number | string
- roundedStartEndboolean | number | string
- roundedEndStartboolean | number | string
- roundedEndEndboolean | number | string
- roundedTopRightboolean | number | string
- roundedTopLeftboolean | number | string
- roundedBottomLeftboolean | number | string
- roundedBottomRightboolean | number | string
- seriesrequisArray<IChartSeries>[]
- Data series. series[0].data must be an array of { date, open, high, low, close } objects. Extra series are ignored.
- subtitlestring
- Optional subtitle rendered below the title.
- Anchor of the legend block: top, bottom, left, right.
- animatedbooleantrue
- Animate candles on first paint. Respects prefers-reduced-motion.
- animationDurationnumber600
- Animation duration in milliseconds.
- Palette used when a series does not pin its own color. Cycles through the 8 origam intents by default.
API
Slots
Emplacements de contenu exposés par ce composant.
- #tooltip
- Replace the default tooltip card. Receives full OHLC datum, change and direction for custom rendering.
- #legend-item
- Replace one legend entry.
- #title
- Replace the title block (title + subtitle).
- #empty
- Rendered when series is empty or contains no valid OHLC data.
API
Emits
Événements émis par ce composant.
- @point-clickIChartPoint, MouseEvent | KeyboardEvent
- Fired on mouse click or Enter/Space on a candle.
- @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.
- Duration of the candle fade-in animation. Set by animationDuration prop.
- Stroke colour of horizontal grid lines.
- Font size of axis tick labels.
- 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 candles. |
| Enter / Space | Activates the focused candle and fires point-click. |
Notes
- Root element has role="figure" with aria-label set to the title prop or "candlestick chart".
- SVG has role="img" with <title> and <desc> elements describing the data.
- Each candle has role="button", tabindex=0, and aria-label describing date, direction, open, high, low, close.
- 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__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.
Basic candlestick chart
Écosystème
Famille
Composants du même dossier qui partagent les conventions et se composent souvent ensemble.