hydroxy

Sunburst chart

A tree as concentric rings, each arc's sweep its share. Hover, touch or step to an arc to read it; click an arc, or press Enter, to zoom in; click the centre, press Backspace or use the breadcrumb to climb out.

Annual spend by team
ItemValueShare
Spend > Engineering > Platform > Infra26010.2%
Spend > Engineering > Platform > Tooling1606.2%
Spend > Engineering > Product > Web2208.6%
Spend > Engineering > Product > Mobile1606.2%
Spend > Engineering > Data2108.2%
Spend > Engineering > Security903.5%
Spend > Sales > Enterprise30011.7%
Spend > Sales > SMB1807.0%
Spend > Sales > Partners903.5%
Spend > Marketing > Brand1505.9%
Spend > Marketing > Growth2108.2%
Spend > Marketing > Events803.1%
Spend > Support > Tier 11405.5%
Spend > Support > Tier 2903.5%
Spend > Operations > People1104.3%
Spend > Operations > Finance702.7%
Spend > Operations > Legal401.6%

Usage

use hydroxy_leptos::sunburst_chart::*;
use leptos::prelude::*;

fn team(name: &str, parts: &[(&str, f64)]) -> Tree {
    Tree::branch(name, parts.iter().map(|(n, v)| Tree::leaf(*n, *v)).collect())
}

#[component]
pub fn Demo() -> impl IntoView {
    let spend = Tree::branch(
        "Spend",
        vec![
            Tree::branch(
                "Engineering",
                vec![
                    team("Platform", &[("Infra", 260.0), ("Tooling", 160.0)]),
                    team("Product", &[("Web", 220.0), ("Mobile", 160.0)]),
                    Tree::leaf("Data", 210.0),
                    Tree::leaf("Security", 90.0),
                ],
            ),
            team("Sales", &[("Enterprise", 300.0), ("SMB", 180.0), ("Partners", 90.0)]),
            team("Marketing", &[("Brand", 150.0), ("Growth", 210.0), ("Events", 80.0)]),
            team("Support", &[("Tier 1", 140.0), ("Tier 2", 90.0)]),
            team("Operations", &[("People", 110.0), ("Finance", 70.0), ("Legal", 40.0)]),
        ],
    );

    view! { <SunburstChart root=spend label="Annual spend by team" /> }
}

Anatomy

Componentdata-partRenders
SunburstChartrootfigure labelled by `label`; `data-active` while an arc is picked
breadcrumbPath from the root to the current zoom; earlier steps are buttons
plotFocusable group holding the rings, centre and tooltip; keeps focus while zooming
arcSector; `data-depth` is its ring, `data-leaf` when it can't zoom, `data-active` when picked
centerShows the picked arc or the current level; zooms out when clicked
tooltipName, value and share of the current level for the picked arc
legendThe top ring's categories in colour order, when there are two or more
sr-liveAnnounces the picked arc and each zoom
sr-tableEvery leaf with its path, value and share of the whole, for screen readers and CSV export

Keyboard

KeyDoes
ArrowRight / ArrowLeftStep to the next or previous arc, each parent before its children
Home / EndJump to the first or last arc
Enter / SpaceZoom into the picked arc if it has parts
BackspaceZoom out one level
EscapeClear the picked arc; with none picked, zoom out one level

Props

PropTypeNotes
rootTreeRequired. Branch values come from their children
labelStringRequired. What the chart shows; the accessible name
sizeu16Diameter in px. Default 420
depthu8Rings drawn, 1 to 4. Default 3
formatFn(f64) -> StringFormats values in the centre, 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
viewSignal<View>Controlled focused node. Uncontrolled when left off
on_view_changeCallback<View>Called when the focused node changes; not for changes that came from `view`
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