Candlestick

OHLC financial chart — each period a high–low wick and an open↔close body, coloured up/down.

Category: chart · WCAG 2.1-AA · chart, candlestick, ohlc, financial, data-viz

Props

PropTypeDefaultDescription
dataCandlestickDatum[]One candle per period: { t, open, high, low, close, volume? }.
titlestringChart title (also aria-label).
descriptionstringSupporting description text.
widthnumberFixed SVG width in px. ⚠ **Omit for a responsive chart** — the chart fills and tracks its container via a ResizeObserver; there is no correct pixel number in a responsive grid. A fixed width is clamped to the container (max-inline-size: 100%) so it can never overflow its card, but it also stops the chart growing. `useChartSize` is NOT needed for this — charts call it internally.
heightnumber320SVG height in px. Unlike `width`, height does NOT track the container — this is the knob you set to change the chart's aspect.
yTicksnumber5Approximate number of ticks on the y-axis.
upColorstringColour for up candles (close ≥ open).
downColorstringColour for down candles (close < open).
volumebooleanfalseRender volume bars beneath the candles.
tooltipbooleanEnable hover tooltip (OHLC).
classNamestringAdditional CSS class names merged onto the root element.
plainbooleanfalseMarks only — no axes. For micro/inline charts.
annotationsAnnotation[]Reference lines/bands/markers over the plot (e.g. a last-price rule).
brushbooleanKeyboard-operable Brush below the plot to subset the candles to a window.
dataZoombooleanDataZoom slider below the plot — a Brush whose body also pans the window.
zoombooleanIn-plot wheel/drag/keyboard zoom-pan (+/-/0) over the candle index window.
syncIdstringConnect charts sharing this id — they mirror the zoom window.
tooltipMode'item' | 'axis'itemitem (nearest candle) or axis (crosshair + OHLC at the hovered x).

Design tokens

When to use

When not to use

Examples

OHLC price series

import { Candlestick } from '@cascivo/charts'

<Candlestick
  title="ACME daily"
  tooltip
  data={[
    { t: 'Mon', open: 10, high: 14, low: 9, close: 13 },
    { t: 'Tue', open: 13, high: 15, low: 11, close: 11 },
    { t: 'Wed', open: 11, high: 12, low: 8, close: 9 },
  ]}
/>

Zoomable with a last-price rule

<Candlestick
  title="ACME daily"
  data={candles}
  volume
  zoom
  dataZoom
  tooltipMode="axis"
  annotations={[{ kind: 'line', axis: 'y', value: lastClose, label: '42.77' }]}
/>

Related components

← Back to docs