hydroxy

OHLC chart

Open, high, low and close per period as a thin bar with the open ticked left and the close ticked right. Lighter than candlesticks when there are many periods.

ACME daily, October
PeriodOpenHighLowCloseVolume
1 Oct$148.00$148.56$147.39$147.64–
2 Oct$147.64$148.66$146.91$147.14–
5 Oct$147.14$150.26$146.00$149.79–
6 Oct$149.79$150.97$149.59$150.54–
7 Oct$150.54$151.48$146.52$147.07–
8 Oct$147.07$150.23$145.15$148.37–
9 Oct$148.37$148.88$146.28$146.61–
12 Oct$146.61$147.28$145.91$146.71–
13 Oct$146.71$148.02$145.98$147.59–
14 Oct$147.59$152.18$146.27$151.57–
15 Oct$151.57$152.38$150.03$150.40–
16 Oct$150.40$151.10$150.10$150.37–
19 Oct$150.37$151.42$149.01$149.59–
20 Oct$149.59$153.36$149.32$152.47–
21 Oct$152.47$155.25$152.42$153.61–
22 Oct$153.61$158.90$153.26$156.68–
23 Oct$156.68$157.58$156.10$156.65–
26 Oct$156.65$158.32$155.74$156.71–
27 Oct$156.71$159.43$155.13$158.39–
28 Oct$158.39$159.51$156.96$159.38–

Usage

use hydroxy_leptos::ohlc_chart::{Annotation, Candle, OhlcChart};
use leptos::prelude::*;

#[component]
pub fn Demo() -> impl IntoView {
    let candles = vec![
        Candle::new(148.00, 148.56, 147.39, 147.64),
        Candle::new(147.64, 148.66, 146.91, 147.14),
        Candle::new(147.14, 150.26, 146.00, 149.79),
        Candle::new(149.79, 150.97, 149.59, 150.54),
        Candle::new(150.54, 151.48, 146.52, 147.07),
        Candle::new(147.07, 150.23, 145.15, 148.37),
        Candle::new(148.37, 148.88, 146.28, 146.61),
        Candle::new(146.61, 147.28, 145.91, 146.71),
        Candle::new(146.71, 148.02, 145.98, 147.59),
        Candle::new(147.59, 152.18, 146.27, 151.57),
        Candle::new(151.57, 152.38, 150.03, 150.40),
        Candle::new(150.40, 151.10, 150.10, 150.37),
        Candle::new(150.37, 151.42, 149.01, 149.59),
        Candle::new(149.59, 153.36, 149.32, 152.47),
        Candle::new(152.47, 155.25, 152.42, 153.61),
        Candle::new(153.61, 158.90, 153.26, 156.68),
        Candle::new(156.68, 157.58, 156.10, 156.65),
        Candle::new(156.65, 158.32, 155.74, 156.71),
        Candle::new(156.71, 159.43, 155.13, 158.39),
        Candle::new(158.39, 159.51, 156.96, 159.38),
    ];
    let labels: Vec<String> =
        [1, 2, 5, 6, 7, 8, 9, 12, 13, 14, 15, 16, 19, 20, 21, 22, 23, 26, 27, 28].map(|d| format!("{d} Oct")).to_vec();

    view! {
        <OhlcChart
            candles=candles
            labels=labels
            label="ACME daily, October"
            annotations=vec![Annotation::y_line(155.0, "Resistance")]
            format=|v: f64| format!("${v:.2}")
        />
    }
}

Anatomy

Componentdata-partRenders
OhlcChartrootfigure with a screen-reader table of every period
overlayFocusable plot; arrow keys move between periods
barOne per period, data-dir up or down
rangeLow to high
openTick to the left at the open
closeTick to the right at the close
annotationReference line, band or point

Keyboard

KeyDoes
ArrowRight / ArrowLeftNext or previous period
Home / EndFirst or last period
EscapeClear

Props

PropTypeNotes
candlesVec<Candle>Required. Candle::new(open, high, low, close), oldest first
labelsVec<String>Required. One per period, such as a date
labelStringRequired. What the chart shows; the accessible name
scaleScaleKindLinear, Log or Symlog price axis. Default Linear
annotationsVec<Annotation>Y in prices, x in period indices
heightu16Plot height in px. Default 260
formatFn(f64) -> StringFormats prices on the axis, tooltip and table

Events

PropTypeNotes
on_hoverCallback<Option<Datum>>The mark under the pointer or keyboard focus changes, or is left. Fires only on a change
on_selectCallback<Datum>Click, tap or Enter on a mark
Actions
Button
Icon button
Toolbar
Theme menu
Display
Avatar
Badge
Card
Chip
Code block
Markdown
Doc card
Due pill
Kbd
Priority mark
Source chip
Space icon
Status diamond
Tag
Value diff
Carousel
Reveal
Media timeline
QR code
Transcript viewer
Audio waveform
Audio player
Forms
Calendar
Checkbox
Combobox
Date picker
Color picker
Cron builder
Theme editor
Mention input
Signature pad
Image cropper
Date field
Date range picker
Duration field
Quantity stepper
Filter chip
Input
Markdown editor
Radio group
Search field
Segmented control
Select
Slider
Range slider
Rating
Toggle button
File dropzone
Upload queue
Attachment
Switch
Tags input
Number field
Money field
Phone field
Time field
OTP input
Password field
Questionnaire
Availability picker
Voice input
Recording control
Inline edit
Async validated input
Shortcut recorder
Data
Spreadsheet grid
Week scheduler
Virtual list
Stat card
Step track
Kanban board
Sortable list
Filter builder
Data table
Grid
Access editor
File manager
Gantt chart
Log stream
Diff viewer
JSON inspector
Terminal
Node editor
Whiteboard
Navigation
Table of contents
Breadcrumb
Tabs
Wizard
Nav item
Nav section
Tree view
Pagination
Menubar
Navigation menu
Saved views
Layout
Master detail
App shell
Sidebar layout
Resizable panels
Dashboard layout
Dock layout
Feedback
Callout
Check list
Empty state
Progress bar
Toast
Approval card
Skeleton
Notification center
Bars
Bar chart
Diverging bar chart
Span chart
Pictogram chart
Stacked bar chart
Funnel chart
Bullet chart
Waffle chart
Marimekko chart
Dot plot chart
Error bar chart
Pareto chart
Waterfall chart
Lollipop chart
Grouped bar chart
Bar race chart
KPIs and frames
Chart frame
Metric card
Sparkline
Points
Scatter chart
Smith chart
Strip plot
Beeswarm chart
Parallel coordinates
Ternary chart
Bland-Altman chart
Quiver chart
Connected scatter chart
Grids and tables
Heatmap chart
Chart table
Cohort chart
Radial
Radial charts
Radar chart
Polar area chart
Stat ring
Clock chart
Spiral chart
Lines and areas
Bump chart
Slope chart
Line chart
Composed chart
Small multiples
Cycle plot chart
Horizon chart
Stacked area chart
Threshold chart
Split line chart
Linked charts
Confidence band chart
Forecast fan chart
Step chart
Range area chart
Distributions
Contour chart
Histogram
Box plot
Density chart
Ridgeline chart
Violin chart
Q-Q chart
Survival chart
ECDF chart
Raincloud plot
Forest plot
Maps
Geo map
Bubble map
Hexbin map
Cartogram
Flow map
Parts of a whole
Donut chart
Voronoi treemap
Nested donut chart
Treemap chart
Sunburst chart
Bubble pack chart
Icicle chart
Flame graph chart
Pie chart
Word cloud
Relationships
Sankey chart
Network chart
Chord chart
UpSet chart
Venn chart
Alluvial chart
Adjacency matrix chart
Dependency graph chart
Tree chart
Arc diagram
Hive plot
Edge bundling
Finance
Candlestick chart
OHLC chart
Depth chart
Renko chart
Time
Timeline chart
Calendar heatmap chart
Spectrogram chart
Marey chart
Overlays
Tour
Lightbox
Alert dialog
Command palette
Dialog
Menu
Popover
Tooltip
Sheet
Hover card
Context menu
Utilities
Pacer
Hotkeys
Disclosure
Accordion
Collapsible
Chat
Chat bubble
Voice session
Composer
Thread
Thread list
Assistant composer
Assistant MCP
Assistant modal
Assistant thread
Assistant thread list
Message scroller
Insight note
Emoji picker
Tool trace
Model picker
Citation popover
Activity
Activity feed
Comment thread
Timeline
Presence bar
Live cursors
Reaction bar
Guides
Getting started
All components
All charts