ChartCandlestick

Data Visualization
stable

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.

Anatomy of OrigamChartCandlestickSchematic of the candlestick chart component with numbered internal parts. Chart title 1 2 3 4 5 6 Bullish Bearish
Anatomy of <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.

height
number | string
400
Chart height. Accepts a number (px) or any CSS length. Overridden by aspectRatio when set.
bullishColor
'success'
Fill colour for bullish candles (close ≥ open). Accepts a TIntent token or any CSS colour.
bearishColor
'danger'
Fill colour for bearish candles (close < open). Accepts a TIntent token or any CSS colour.
candleWidth
number
0.6
Fraction of the per-slot width occupied by the candle body. Range 0–1.
wickWidth
number
1
Wick stroke width in SVG user-units.
showLegend
boolean
false
Toggle the legend. Defaults to false — candlestick charts rarely need a legend.
showTooltip
boolean
true
Toggle the hover tooltip.
showGrid
boolean
true
Render background grid lines.
showAxis
boolean
true
Render X and Y axes with tick labels.
yMin
number
Override the auto-computed Y-axis minimum. When omitted, derived from min(low) with 5% padding.
yMax
number
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.
style
string | Array<string> | object | StyleValue
title
string
Optional chart title rendered above the plotting area.
id
string
class
string | Array<string> | object
width
number | string
aspectRatio
string
CSS aspect-ratio shortcut (e.g. "16/9"). When set, overrides height.
maxHeight
number | string
maxWidth
number | string
minHeight
number | string
minWidth
number | string
bgColor
TColor
rounded
boolean | number | string | TRounded | null | undefined
elevation
TElevation
padding
boolean | number | string
margin
boolean | number | string
fontSize
TFontSize
fontWeight
TFontWeight
paddingTop
boolean | number | string
paddingLeft
boolean | number | string
paddingBottom
boolean | number | string
paddingRight
boolean | number | string
paddingBlock
boolean | number | string
paddingInline
boolean | number | string
paddingInlineStart
boolean | number | string
paddingInlineEnd
boolean | number | string
paddingBlockStart
boolean | number | string
paddingBlockEnd
boolean | number | string
marginTop
boolean | number | string
marginLeft
boolean | number | string
marginBottom
boolean | number | string
marginRight
boolean | number | string
marginBlock
boolean | number | string
marginInline
boolean | number | string
marginInlineStart
boolean | number | string
marginInlineEnd
boolean | number | string
marginBlockStart
boolean | number | string
marginBlockEnd
boolean | number | string
roundedStartStart
boolean | number | string
roundedStartEnd
boolean | number | string
roundedEndStart
boolean | number | string
roundedEndEnd
boolean | number | string
roundedTopRight
boolean | number | string
roundedTopLeft
boolean | number | string
roundedBottomLeft
boolean | number | string
roundedBottomRight
boolean | number | string
series
requis
Array<IChartSeries>
[]
Data series. series[0].data must be an array of { date, open, high, low, close } objects. Extra series are ignored.
subtitle
string
Optional subtitle rendered below the title.
legendPosition
'bottom'
Anchor of the legend block: top, bottom, left, right.
animated
boolean
true
Animate candles on first paint. Respects prefers-reduced-motion.
animationDuration
number
600
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-click
IChartPoint, MouseEvent | KeyboardEvent
Fired on mouse click or Enter/Space on a candle.
@legend-click
IChartSeries, number
Fired when the user clicks a legend entry.
@series-toggle
IChartSeries, 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

figure
img
button

Interactions clavier

Interactions clavier
ToucheAction
TabMoves focus between interactive candles.
Enter / SpaceActivates 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.

Source
color
var(--origam-color__surface---default)
Root chart background.
dimension
var(--origam-space---3)
Chart inner padding.
color
var(--origam-color__border---subtle)
Grid line colour.
color
var(--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

vue

Écosystème

Famille

Composants du même dossier qui partagent les conventions et se composent souvent ensemble.