hydroxy

Cohort chart

A retention triangle: one row per cohort (everyone who started in the same period) with its size, and one cell per period since, shaded by the share still active. The ramp tops out at the best rate after period 0, so differences in later periods stay visible. Cells fade in along the diagonals.

Paying customers by signup month

Share of each month's signups still paying. Later cohorts hold on better after the March onboarding change.

100%55%43%38%35%33%32%31%30%100%57%45%40%37%35%34%33%100%59%48%43%40%38%36%100%61%50%45%42%40%100%63%52%47%44%100%64%53%48%100%65%55%100%66%100%
Monthly retention by signup month
CohortSizeMonth 0Month 1Month 2Month 3Month 4Month 5Month 6Month 7Month 8
Jan 20261204100%55%43%38%35%33%32%31%30%
Feb 20261118100%57%45%40%37%35%34%33%–
Mar 20261356100%59%48%43%40%38%36%––
Apr 20261290100%61%50%45%42%40%–––
May 20261472100%63%52%47%44%––––
Jun 20261538100%64%53%48%–––––
Jul 20261611100%65%55%––––––
Aug 20261704100%66%–––––––
Sep 20261689100%––––––––

Usage

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

pub fn demo() -> AnyView {
    // Customers by signup month, and how many were still paying each month after.
    let cohorts = vec![
        Cohort::new("Jan 2026", 1_204.0, [1_204.0, 662.0, 518.0, 457.0, 421.0, 398.0, 381.0, 370.0, 362.0]),
        Cohort::new("Feb 2026", 1_118.0, [1_118.0, 637.0, 503.0, 449.0, 413.0, 392.0, 377.0, 366.0]),
        Cohort::new("Mar 2026", 1_356.0, [1_356.0, 801.0, 646.0, 579.0, 538.0, 511.0, 494.0]),
        Cohort::new("Apr 2026", 1_290.0, [1_290.0, 787.0, 640.0, 576.0, 537.0, 514.0]),
        Cohort::new("May 2026", 1_472.0, [1_472.0, 927.0, 762.0, 690.0, 646.0]),
        Cohort::new("Jun 2026", 1_538.0, [1_538.0, 984.0, 818.0, 741.0]),
        Cohort::new("Jul 2026", 1_611.0, [1_611.0, 1_047.0, 880.0]),
        Cohort::new("Aug 2026", 1_704.0, [1_704.0, 1_125.0]),
        Cohort::new("Sep 2026", 1_689.0, [1_689.0]),
    ];
    let periods: Vec<String> = (0..9).map(|m| format!("Month {m}")).collect();

    view! {
        <ChartFrame title="Paying customers by signup month" description="Share of each month's signups still paying. Later cohorts hold on better after the March onboarding change." export=true>
            <CohortChart cohorts periods label="Monthly retention by signup month" noun="customers" />
        </ChartFrame>
    }
    .into_any()
}

Anatomy

Componentdata-partRenders
CohortChartrootfigure with a screen-reader table of every rate
row-labelCohort name and its size
cellsFocusable grid; arrow keys move between cells
cellShaded by --level, labelled with its percentage; --i is its diagonal
tooltipCohort, period and the count behind the rate
scaleThe colour ramp from 0% to the best later rate
sr-liveAnnounces the active cell

Keyboard

KeyDoes
ArrowLeft / ArrowRightMove along a cohort; the first press lands on the top-left cell
ArrowUp / ArrowDownMove between cohorts, staying inside the triangle
Home / EndFirst or latest period of the cohort
EscapeClear the active cell

Props

PropTypeNotes
cohortsVec<Cohort>Required. Cohort::new(name, size, counts per period so far)
periodsVec<String>Required. One label per period
labelStringRequired. What the chart shows; the accessible name
nounStringWhat a count is of, for the tooltip. Default "people"
cell_heightu16Cell height in px. Default 32
formatFn(f64) -> StringFormats sizes and counts
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