Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Candlestick chart

OHLC price per period rendered as a body (open → close) with a thin wick spanning the period high → low.

The demo plots the Dow Jones Industrial Average around the Wall Street Crash of 1929 — eight trading days from Mon Oct 21 through Wed Oct 30 1929, spanning Black Thursday (Oct 24), Black Monday (Oct 28), and Black Tuesday (Oct 29). The Oct 28 candle's body is the day the Dow lost 13 % in a single session; Oct 29 cut another 12 %, then a partial recovery on the 30th set the tone for the Great Depression to come.

Source: Wall Street Crash of 1929 — Wikipedia

Public surface

use wisp_chart::finance::{Candlestick, Period};

let c = Candlestick::new(vec![
    Period::new(100.0, 110.0, 95.0, 108.0),
    Period::new(108.0, 115.0, 105.0, 102.0),
    /* ... */
]);
let g = c.emit_graphics(&theme, Vec2::new(480.0, 240.0));

Info

Up periods (close >= open) use up_color (green default); down periods use down_color (red default). Override before emission for brand colours.

Why not a Plot mark

Note

Period { open, high, low, close } doesn't fit the (X, Y, Color) channel model of the Plot facade — it's 4 numeric fields per row. Candlestick / OHLC / waterfall ship as self-contained value types under wisp_chart::finance instead.