Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Calendar / annual heatmap

GitHub-style contribution graph or year-in-review heatmap — one cell per day, 7 rows × 53 columns, colour intensity reflects daily value.

The demo plots weekly excess-mortality from influenza + pneumonia in NYC across 1918 — the year the Spanish flu killed more Americans than World War I, World War II, the Korean War, and the Vietnam War combined. The lighter March / April band is the "first wave"; the saturated October cluster is the catastrophic autumn second wave that peaked at ~13 weekly deaths per 10 k population.

Source: 1918 flu pandemic in the United States — Wikipedia

Public surface

use wisp_chart::heatmap::{CalendarHeatmap, CalendarValue, SequentialPalette};
use jiff::civil::date;

let cal = CalendarHeatmap::new(2025, vec![
    CalendarValue::new(date(2025, 1, 15),  5.0),
    CalendarValue::new(date(2025, 6, 1),  12.0),
    /* ... */
])
.palette(SequentialPalette::github());
let g = cal.emit_graphics(&theme, Vec2::new(720.0, 120.0));

Layout

Info

Columns are ISO weeks (1..52, occasionally 53 for leap years). Rows are weekdays — Monday at row 0, Sunday at row 6. Days with no entry render at the palette's 0.0 stop. Values from other years are silently ignored so reusing a multi-year dataset across multiple heatmaps is safe.

Date math via jiff

Note

wisp-chart depends on jiff for date / weekday / ISO-week math. jiff is scoped to this crate's Cargo.toml so wisp itself stays date-free.