1. Components
  2. candlestick

Candlestick

Candlesticks for prices: open, close, low and high.

Simple

Rows need open , close , low and high columns. Rising periods take your theme's --success , falling ones --destructive .

Share price this week
Day Open Close Low High
Mon $182.1 $184.6 $181.2 $185.4
Tue $184.6 $183 $182.3 $186.1
Wed $183 $187.9 $182.8 $188.5
Thu $187.9 $186.2 $185.1 $189
Fri $186.2 $190.4 $185.9 $191.2
@php
    $week = [
        ['day' => 'Mon', 'open' => 182.1, 'close' => 184.6, 'low' => 181.2, 'high' => 185.4],
        ['day' => 'Tue', 'open' => 184.6, 'close' => 183.0, 'low' => 182.3, 'high' => 186.1],
        ['day' => 'Wed', 'open' => 183.0, 'close' => 187.9, 'low' => 182.8, 'high' => 188.5],
        ['day' => 'Thu', 'open' => 187.9, 'close' => 186.2, 'low' => 185.1, 'high' => 189.0],
        ['day' => 'Fri', 'open' => 186.2, 'close' => 190.4, 'low' => 185.9, 'high' => 191.2],
    ];
@endphp

<x-ui.echart type="candlestick" :data="$week" index="day" prefix="$" format="number" label="Share price this week" class="h-72 w-full" />

Forty days, with zoom

Share price, last 40 days
Date Open Close Low High
Sep 24 $182 $184.5 $180.5 $185.7
Sep 25 $184.5 $185.49 $182 $187.69
Sep 26 $185.49 $185.55 $181.99 $188.75
Sep 27 $185.55 $189.86 $181.05 $191.06
Sep 28 $189.86 $195.92 $188.36 $198.12
Sep 29 $195.92 $198.4 $193.42 $201.6
Sep 30 $198.4 $200.25 $194.9 $201.45
Oct 1 $200.25 $205.11 $195.75 $207.31
Oct 2 $205.11 $208.22 $203.61 $211.42
Oct 3 $208.22 $206.49 $203.99 $209.42
Oct 4 $206.49 $205.04 $201.54 $208.69
Oct 5 $205.04 $205.51 $200.54 $208.71
Oct 6 $205.51 $202.53 $201.03 $206.71
Oct 7 $202.53 $196.33 $193.83 $204.73
Oct 8 $196.33 $192.92 $189.42 $199.53
Oct 9 $192.92 $191.42 $186.92 $194.12
Oct 10 $191.42 $186.98 $185.48 $193.62
Oct 11 $186.98 $182.64 $180.14 $190.18
Oct 12 $182.64 $183.24 $179.14 $184.44
Oct 13 $183.24 $185.03 $178.74 $187.23
Oct 14 $185.03 $184.41 $182.91 $188.23
Oct 15 $184.41 $186 $181.91 $187.2
Oct 16 $186 $191.86 $182.5 $194.06
Oct 17 $191.86 $196.21 $187.36 $199.41
Oct 18 $196.21 $197.67 $194.71 $198.87
Oct 19 $197.67 $201.44 $195.17 $203.64
Oct 20 $201.44 $206.63 $197.94 $209.83
Oct 21 $206.63 $207.43 $202.13 $208.63
Oct 22 $207.43 $205.57 $204.07 $209.63
Oct 23 $205.57 $206.03 $203.07 $209.23
Oct 24 $206.03 $205.71 $202.21 $207.23
Oct 25 $205.71 $200.65 $196.15 $207.91
Oct 26 $200.65 $195.5 $194 $203.85
Oct 27 $195.5 $193.75 $191.25 $196.7
Oct 28 $193.75 $190.76 $187.26 $195.95
Oct 29 $190.76 $185.17 $180.67 $193.96
Oct 30 $185.17 $182.87 $181.37 $186.37
Oct 31 $182.87 $184.44 $180.37 $186.64
Nov 1 $184.44 $184.35 $180.85 $187.64
Nov 2 $184.35 $183.66 $179.16 $185.55
@php
    $price = 182.0;
    $days = collect(range(0, 39))->map(function (int $i) use (&$price) {
        $open = $price;
        $close = round($open + sin($i / 3) * 4 + cos($i * 1.7) * 2.5, 2);
        $price = $close;

        return [
            'date' => now()->subDays(40 - $i)->format('M j'),
            'open' => $open,
            'close' => $close,
            'low' => round(min($open, $close) - 1.5 - ($i % 4), 2),
            'high' => round(max($open, $close) + 1.2 + ($i % 3), 2),
        ];
    })->all();
@endphp

{{-- Candlestick reads the open, close, low and high columns. --}}
<x-ui.echart type="candlestick" zoom :data="$days" index="date" prefix="$" format="number" label="Share price, last 40 days" class="h-80 w-full" />

See Chart for installation and every prop.