hydroxy

Small multiples

The same chart repeated for each facet, such as a region or product, in a grid that wraps to fit. Every panel shares one value axis so heights compare across panels, the series keep their colours everywhere, and one legend names them. Panels enter one after another.

Weekly signups by region

Organic and paid signups this quarter. Every panel shares one axis, so London's lead reads at a glance.

London

Weekly signups by region: London
OrganicPaid
W1410220
W2432240
W3451236
W4470261
W5466280
W6498276
W7521301
W8540318
W9552309
W10571335
W11590342
W12612360

Manchester

Weekly signups by region: Manchester
OrganicPaid
W118090
W218696
W3195104
W420199
W5214112
W6209118
W7226121
W8238130
W9244128
W10252137
W11265141
W12271150

Edinburgh

Weekly signups by region: Edinburgh
OrganicPaid
W112040
W211844
W312648
W413146
W512952
W614055
W714658
W815161
W914960
W1015866
W1116270
W1217072

Bristol

Weekly signups by region: Bristol
OrganicPaid
W114070
W214668
W315175
W416081
W515879
W616786
W717192
W818090
W918697
W10184101
W1119399
W12201108

Leeds

Weekly signups by region: Leeds
OrganicPaid
W115060
W214966
W315563
W416270
W517074
W616879
W717677
W818185
W918988
W1019686
W1119493
W1220597

Cardiff

Weekly signups by region: Cardiff
OrganicPaid
W18030
W28433
W38331
W49036
W59438
W69241
W79940
W810344
W910147
W1010846
W1111250
W1211553

Monthly rainfall

Millimetres per month. On a shared axis the monsoon dwarfs a Scottish winter.

Glasgow

Average monthly rainfall by city: Glasgow
Average monthly rainfall by city: Glasgow
Jan128 mm
Feb92 mm
Mar98 mm
Apr61 mm
May63 mm
Jun62 mm
Jul69 mm
Aug86 mm
Sep99 mm
Oct125 mm
Nov119 mm
Dec124 mm

London

Average monthly rainfall by city: London
Average monthly rainfall by city: London
Jan55 mm
Feb41 mm
Mar41 mm
Apr44 mm
May49 mm
Jun45 mm
Jul45 mm
Aug50 mm
Sep49 mm
Oct69 mm
Nov59 mm
Dec55 mm

Madrid

Average monthly rainfall by city: Madrid
Average monthly rainfall by city: Madrid
Jan33 mm
Feb34 mm
Mar25 mm
Apr46 mm
May50 mm
Jun19 mm
Jul10 mm
Aug9 mm
Sep21 mm
Oct59 mm
Nov52 mm
Dec43 mm

Mumbai

Average monthly rainfall by city: Mumbai
Average monthly rainfall by city: Mumbai
Jan1 mm
Feb0 mm
Mar0 mm
Apr1 mm
May11 mm
Jun538 mm
Jul841 mm
Aug514 mm
Sep319 mm
Oct55 mm
Nov15 mm
Dec4 mm

Usage

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

pub fn demo() -> AnyView {
    let weeks: Vec<String> = (1..=12).map(|w| format!("W{w}")).collect();
    // Weekly signups by region, organic against paid. Every panel shares one value axis.
    let regions = [
        (
            "London",
            [410.0, 432.0, 451.0, 470.0, 466.0, 498.0, 521.0, 540.0, 552.0, 571.0, 590.0, 612.0],
            [220.0, 240.0, 236.0, 261.0, 280.0, 276.0, 301.0, 318.0, 309.0, 335.0, 342.0, 360.0],
        ),
        (
            "Manchester",
            [180.0, 186.0, 195.0, 201.0, 214.0, 209.0, 226.0, 238.0, 244.0, 252.0, 265.0, 271.0],
            [90.0, 96.0, 104.0, 99.0, 112.0, 118.0, 121.0, 130.0, 128.0, 137.0, 141.0, 150.0],
        ),
        (
            "Edinburgh",
            [120.0, 118.0, 126.0, 131.0, 129.0, 140.0, 146.0, 151.0, 149.0, 158.0, 162.0, 170.0],
            [40.0, 44.0, 48.0, 46.0, 52.0, 55.0, 58.0, 61.0, 60.0, 66.0, 70.0, 72.0],
        ),
        (
            "Bristol",
            [140.0, 146.0, 151.0, 160.0, 158.0, 167.0, 171.0, 180.0, 186.0, 184.0, 193.0, 201.0],
            [70.0, 68.0, 75.0, 81.0, 79.0, 86.0, 92.0, 90.0, 97.0, 101.0, 99.0, 108.0],
        ),
        (
            "Leeds",
            [150.0, 149.0, 155.0, 162.0, 170.0, 168.0, 176.0, 181.0, 189.0, 196.0, 194.0, 205.0],
            [60.0, 66.0, 63.0, 70.0, 74.0, 79.0, 77.0, 85.0, 88.0, 86.0, 93.0, 97.0],
        ),
        (
            "Cardiff",
            [80.0, 84.0, 83.0, 90.0, 94.0, 92.0, 99.0, 103.0, 101.0, 108.0, 112.0, 115.0],
            [30.0, 33.0, 31.0, 36.0, 38.0, 41.0, 40.0, 44.0, 47.0, 46.0, 50.0, 53.0],
        ),
    ];
    let signups: Vec<Facet> = regions
        .iter()
        .map(|(name, organic, paid)| {
            Facet::new(*name, vec![Series::new("Organic", *organic), Series::new("Paid", *paid)])
        })
        .collect();

    let months: Vec<String> =
        ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"].map(String::from).to_vec();
    let rainfall = vec![
        Facet::new(
            "Glasgow",
            vec![Series::new("Rainfall", [128.0, 92.0, 98.0, 61.0, 63.0, 62.0, 69.0, 86.0, 99.0, 125.0, 119.0, 124.0])],
        ),
        Facet::new(
            "London",
            vec![Series::new("Rainfall", [55.0, 41.0, 41.0, 44.0, 49.0, 45.0, 45.0, 50.0, 49.0, 69.0, 59.0, 55.0])],
        ),
        Facet::new(
            "Madrid",
            vec![Series::new("Rainfall", [33.0, 34.0, 25.0, 46.0, 50.0, 19.0, 10.0, 9.0, 21.0, 59.0, 52.0, 43.0])],
        ),
        Facet::new(
            "Mumbai",
            vec![Series::new("Rainfall", [1.0, 0.0, 0.0, 1.0, 11.0, 538.0, 841.0, 514.0, 319.0, 55.0, 15.0, 4.0])],
        ),
    ];

    view! {
        <div style="display: grid; gap: var(--space-10);">
            <ChartFrame title="Weekly signups by region" description="Organic and paid signups this quarter. Every panel shares one axis, so London's lead reads at a glance." export=true>
                <SmallMultiples facets=signups labels=weeks label="Weekly signups by region" />
            </ChartFrame>
            <ChartFrame title="Monthly rainfall" description="Millimetres per month. On a shared axis the monsoon dwarfs a Scottish winter.">
                <SmallMultiples facets=rainfall labels=months label="Average monthly rainfall by city" kind=Kind::Bar height=120 min_width=200 format=|v: f64| format!("{v:.0} mm") />
            </ChartFrame>
        </div>
    }
    .into_any()
}

Anatomy

Componentdata-partRenders
SmallMultiplesrootgroup named by label, holding the legend and grid
legendSeries names and colours, once for the whole grid (two or more series)
gridWraps panels to the container; none narrower than min_width
facetOne panel; --facet staggers its entrance
facet-titleThe facet's name above its chart

Keyboard

KeyDoes
TabMoves between panels; each chart keeps its own arrow keys

Props

PropTypeNotes
facetsVec<Facet>Required. Facet::new(title, series); every facet lists the same series in the same order
labelsVec<String>Required. One label per x position, shared by every facet
labelStringRequired. What the grid shows; each panel is named label plus its title
kindKindLine (default), Area, StackedArea or Bar (each facet's first series)
heightu16Plot height of each panel in px. Default 140
min_widthu16Narrowest panel before the grid wraps, in px. Default 240
independentboolGive each facet its own value axis instead of the shared one
formatFn(f64) -> StringFormats axes, tooltips and tables
y_domain(f64, f64)On LineChart, BarChart and StackedAreaChart: a range the value axis must cover. Small multiples pass the shared one

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