hydroxy

Step chart

For values that hold and then jump, such as prices, rates and headcount. Lines step instead of sloping, so nobody reads a change as gradual, and labelled events mark why.

Base rate

The policy rate after each monthly decision, January 2022 to December 2024.

Base rate by month
Base rateEvent
Jan 220.25%
Feb 220.50%First rise
Mar 220.75%
Apr 220.75%
May 221.00%
Jun 221.25%
Jul 221.25%
Aug 221.75%
Sep 222.25%
Oct 222.25%
Nov 223.00%
Dec 223.50%
Jan 233.50%
Feb 234.00%
Mar 234.25%
Apr 234.25%
May 234.50%
Jun 235.00%
Jul 235.00%
Aug 235.25%Peak at 5.25%
Sep 235.25%
Oct 235.25%
Nov 235.25%
Dec 235.25%
Jan 245.25%
Feb 245.25%
Mar 245.25%
Apr 245.25%
May 245.25%
Jun 245.25%
Jul 245.25%
Aug 245.00%First cut
Sep 245.00%
Oct 245.00%
Nov 244.75%
Dec 244.75%

Headcount by team

People employed at the end of each quarter.

Headcount by team and quarter
EngineeringSupport
Q1 254218
Q2 254222
Q3 254822
Q4 255522
Q1 265526
Q2 266126
Q3 266130
Q4 266430

Usage

use hydroxy_leptos::chart_frame::ChartFrame;
use hydroxy_leptos::step_chart::*;
use leptos::prelude::*;

pub fn demo() -> AnyView {
    let months: Vec<String> = (2022..=2024)
        .flat_map(|y| {
            ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
                .map(|m| format!("{m} {}", y % 100))
        })
        .collect();
    // The rate set at each month's meeting; it holds until the next change.
    let rate = vec![
        0.25, 0.5, 0.75, 0.75, 1.0, 1.25, 1.25, 1.75, 2.25, 2.25, 3.0, 3.5, 3.5, 4.0, 4.25, 4.25, 4.5, 5.0, 5.0, 5.25,
        5.25, 5.25, 5.25, 5.25, 5.25, 5.25, 5.25, 5.25, 5.25, 5.25, 5.25, 5.0, 5.0, 5.0, 4.75, 4.75,
    ];
    let events =
        vec![StepEvent::new(1, "First rise"), StepEvent::new(19, "Peak at 5.25%"), StepEvent::new(31, "First cut")];
    let quarters: Vec<String> =
        ["Q1 25", "Q2 25", "Q3 25", "Q4 25", "Q1 26", "Q2 26", "Q3 26", "Q4 26"].map(String::from).to_vec();
    let seats = vec![
        Series::new("Engineering", [42.0, 42.0, 48.0, 55.0, 55.0, 61.0, 61.0, 64.0]),
        Series::new("Support", [18.0, 22.0, 22.0, 22.0, 26.0, 26.0, 30.0, 30.0]),
    ];

    view! {
        <div style="display: grid; gap: var(--space-10);">
            <ChartFrame title="Base rate" description="The policy rate after each monthly decision, January 2022 to December 2024.">
                <StepChart labels=months series=vec![Series::new("Base rate", rate)] events label="Base rate by month" format=|v: f64| format!("{v:.2}%") />
            </ChartFrame>
            // Headcount changes when a quarter closes, so the step lands before each point.
            <ChartFrame title="Headcount by team" description="People employed at the end of each quarter.">
                <StepChart labels=quarters series=seats mode=StepMode::Before label="Headcount by team and quarter" height=200 />
            </ChartFrame>
        </div>
    }
    .into_any()
}

Anatomy

Componentdata-partRenders
StepChartrootfigure with a screen-reader table; data-variant is after, before or middle
lineOne series' steps, revealed left to right
eventA labelled marker that fades in after the lines
event-labelThe event's text, above the plot
crosshairFollows the point in force under the pointer
tooltipEach series' value and any event at that point

Keyboard

KeyDoes
ArrowLeft / ArrowRightPrevious or next point
Home / EndFirst or last point
EscapeHide the tooltip

Props

PropTypeNotes
labelsVec<String>Required. One x label per point
seriesVec<Series>Required. Series::new(name, values); more than six fold into Other
labelStringRequired. What the chart shows; the accessible name
modeStepModeAfter (default), Before or Middle: where each jump falls
eventsVec<StepEvent>StepEvent::new(point index, label)
heightu16Plot height in px. Default 240
scaleScaleKindLinear (default), Log or Symlog
formatFn(f64) -> StringFormats ticks, tooltip and table
annotationsVec<Annotation>Reference lines, bands and points; x is a point index

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