Skip to main content
WireKit
Copy for LLM

Candlestick

Candlestick charts visualize Open-High-Low-Close (OHLC) data — the canonical shape for stock prices, FX rates, and any time-series with a per-bucket range. Chart.js does not render candlesticks natively.

Note: candlestick is an ApexCharts-specific chart type. Switching charts.library to chartjs throws TypeNotSupportedException with a switch-library hint.

When to use

When you have a per-period [open, high, low, close] envelope. For single-value time-series reach for line charts — candlestick is overkill if you don't have ranges.

Basic Example — Daily OHLC

Daily OHLC for a fictional ticker

Combo with overlay — 5-day moving average

<x-wirekit::chart-mixed
    :labels="$dates"
    :datasets="[
        [
            'type' => 'candlestick',
            'name' => 'WIREKIT',
            'data' => $ohlc,
        ],
        [
            'type' => 'line',
            'name' => '5-day MA',
            'data' => $movingAverage,
            'color' => 'var(--color-wk-warning)',
        ],
    ]"
    :options="['xaxis' => ['type' => 'datetime'], 'tooltip' => ['x' => ['format' => 'MMM dd, yyyy HH:mm']]]"
/>

<x-wirekit::chart-mixed> accepts the candlestick series and the moving-average line side-by-side; the line overlays directly on top of the candles.

Real-world recipe — Eloquent OHLC

@php
    $ohlc = \App\Models\StockPrice::query()
        ->where('ticker', 'WIREKIT')
        ->whereBetween('date', [now()->subDays(60), now()])
        ->orderBy('date')
        ->get(['date', 'open', 'high', 'low', 'close'])
        ->map(fn ($r) => [
            'x' => $r->date->toDateString(),
            'y' => [(float) $r->open, (float) $r->high, (float) $r->low, (float) $r->close],
        ])
        ->all();
@endphp

<x-wirekit-chart
    type="candlestick"
    :datasets="[['label' => 'WIREKIT', 'data' => $ohlc]]"
    :options="['xaxis' => ['type' => 'datetime'], 'tooltip' => ['x' => ['format' => 'MMM dd, yyyy HH:mm']]]"
/>

A11y note

Candlestick markers carry no implicit text. Pair every candlestick with a sr-only data table per the canonical a11y recipe (a <table class="sr-only"> companion describing each row's [open, high, low, close] tuple).

License note

ApexCharts is non-MIT — see the License section on the Chart overview page and apexcharts.com/license for the full terms.

See Also

  • Box plot for statistical-distribution visualization (similar visual idiom, different semantics)
  • Timeline for multi-event scheduling

Design Tokens

See ApexCharts adapter — Design Tokens for the color, typography, and grid tokens shared across every ApexCharts demo.

Was this page helpful?

Thank you for your feedback!

Voting requires cookies or local storage. What we store