Calendar heatmap
Since 0.1.0-alpha.22Use a calendar heatmap to spot daily rhythms, streaks and standout days, such as orders over a year. It shows patterns, not amounts. For exact values or the trend, use a line or bar chart of the same days. A few weeks of data looks sparse.
A value for each day
Give CalendarHeatmap the Items, each one's Date and Value, and a Title.
Static
Preview
- 0 to 5
- 5 to 10
- 10 to 15
| Day | Jan | Feb | Mar | Apr | May | Jun | Jul | Aug | Sep | Oct | Nov | Dec |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | 1 | 5 | 5 | 5 | 8 | No data | 8 | 5 | 3 | 9 | No data | 5 |
| 2 | 7 | No data | No data | 1 | 3 | 1 | 3 | No data | 1 | 5 | No data | 1 |
| 3 | 2 | 1 | 5 | 10 | No data | 10 | 1 | 5 | 6 | 14 | 6 | 9 |
| 4 | No data | 9 | 11 | 4 | No data | 4 | 7 | No data | 2 | No data | 2 | 4 |
| 5 | No data | 3 | 6 | No data | 2 | 1 | No data | No data | 1 | No data | 1 | 1 |
| 6 | 2 | 1 | 5 | 5 | 1 | 8 | No data | No data | No data | 12 | 5 | 4 |
| 7 | 11 | 7 | 10 | 3 | 5 | No data | 5 | No data | No data | 7 | 1 | No data |
| 8 | 5 | No data | No data | 1 | 2 | No data | 1 | No data | 10 | 5 | 5 | 1 |
| 9 | 1 | No data | 5 | 7 | 10 | 7 | 10 | No data | 4 | 11 | No data | 6 |
| 10 | 9 | 6 | 8 | 2 | No data | 2 | 4 | No data | 1 | 6 | 1 | 2 |
| 11 | No data | 2 | 5 | 1 | No data | 1 | 1 | No data | 8 | No data | 8 | 1 |
| 12 | No data | 11 | 13 | No data | 9 | 6 | 5 | No data | 3 | No data | 3 | 5 |
| 13 | 8 | 5 | 7 | No data | 3 | 2 | No data | No data | No data | 5 | 1 | No data |
| 14 | 3 | 1 | 5 | 11 | 1 | 5 | 1 | No data | No data | 14 | 7 | 5 |
| 15 | 1 | 5 | No data | 5 | 7 | No data | 7 | No data | 2 | 8 | No data | 4 |
| 16 | 6 | No data | No data | 1 | 2 | 1 | 2 | No data | 1 | 5 | No data | 1 |
| 17 | 2 | 1 | 5 | 9 | No data | 9 | 1 | 5 | 6 | 13 | 5 | 8 |
| 18 | No data | 8 | 10 | 4 | No data | 3 | 6 | 3 | 2 | No data | 2 | 3 |
| 19 | No data | 3 | 6 | No data | 2 | 1 | No data | 1 | 11 | No data | 10 | 1 |
| 20 | 1 | 1 | 15 | 4 | 11 | 7 | 5 | 7 | No data | 11 | 4 | No data |
| 21 | 10 | 6 | 9 | 3 | 5 | No data | 5 | 2 | No data | 6 | 1 | No data |
| 22 | 4 | No data | No data | 1 | 1 | No data | 1 | 1 | 9 | 5 | 5 | 1 |
| 23 | 1 | No data | 5 | 6 | 9 | 6 | 9 | No data | 3 | 10 | No data | 6 |
| 24 | 8 | 5 | 8 | 2 | No data | 2 | 4 | No data | 1 | 6 | 1 | No data |
| 25 | No data | 1 | 5 | 1 | No data | 11 | 1 | 11 | 7 | 5 | 7 | No data |
| 26 | No data | 10 | 12 | No data | 8 | 5 | 4 | 5 | 3 | No data | 2 | No data |
| 27 | 7 | 4 | 7 | No data | 3 | 1 | No data | 1 | No data | 5 | 1 | No data |
| 28 | 2 | 1 | 5 | 10 | 1 | 5 | 1 | 9 | No data | 13 | 6 | No data |
| 29 | 1 | No data | 4 | 6 | No data | 6 | 4 | 2 | 8 | No data | No data | |
| 30 | 5 | No data | 1 | 2 | 1 | 2 | No data | 11 | 5 | 5 | No data | |
| 31 | 2 | 5 | No data | 1 | 4 | 12 | No data |
Code
@* A developer's commits on each day of 2025: steady weekdays, few weekends, two weeks off in August, a quiet holiday week. *@
<CalendarHeatmap Items="_days" Date="d => d.Day" Value="d => d.Commits"
From="new DateOnly(2025, 1, 1)" To="new DateOnly(2025, 12, 31)"
Title="Commits in 2025" />
{
private record DayCommits(DateOnly Day, int Commits);
private readonly DayCommits[] _days = Build();
private static DayCommits[] Build()
{
var start = new DateOnly(2025, 1, 1);
var days = new List<DayCommits>();
for (var d = 0; d < 365; d++)
{
var day = start.AddDays(d);
var weekend = day.DayOfWeek is DayOfWeek.Saturday or DayOfWeek.Sunday;
var away = day >= new DateOnly(2025, 8, 4) && day <= new DateOnly(2025, 8, 15) || day >= new DateOnly(2025, 12, 24);
// A spread from quiet days to busy ones; a weekend now and then.
var noise = (d * 7919 + 13) % 97 / 97.0;
var commits = away ? 0
: weekend ? (noise > 0.8 ? (int)(noise * 6) : 0)
: (int)(1 + 11 * noise * noise + (day.Month is 3 or 10 ? 4 : 0));
// Days without commits aren't in the data, as a query by day would return them.
if (commits > 0) days.Add(new DayCommits(day, commits));
}
return [.. days];
}
}Add this example to a page with the izzy CLI:
izzy add component CalendarHeatmap --at <file>:<line>From and To set the range, here the whole year, so the quiet weeks at its end still show; without them it runs from the first item's day to the last's. Weeks start on the culture's first day, Sunday here, or FirstDayOfWeek.
A day with no value is gray, not the lightest shade: an empty day isn't a zero. Here days without commits aren't in the items, so the shades start at one commit and the quiet days read as gaps. To shade zeros instead, include them.
Point at a day, or move with the arrow keys, for its date and value.
Diverging colors
For values on either side of a meaningful middle, such as each day's temperature against the normal, set Palette to ChartPalette.Diverging. The scale turns gray at Midpoint (0 by default).
Static
Preview
- −15.0 to −10.0
- −10.0 to −5.0
- −5.0 to 0.0
- 0.0 to +5.0
- +5.0 to +10.0
- +10.0 to +15.0
| Day | Jan | Feb | Mar | Apr | May | Jun | Jul | Aug | Sep | Oct | Nov | Dec |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | −1.2 | +1.0 | −1.5 | +1.3 | +1.1 | +1.5 | +2.3 | +1.3 | −0.2 | −0.7 | +1.0 | +2.9 |
| 2 | +0.7 | +0.2 | −2.3 | −0.1 | +1.9 | −0.1 | +2.6 | +2.2 | −0.6 | −0.4 | +1.6 | +4.0 |
| 3 | −0.9 | 0.0 | −3.2 | +0.1 | +3.3 | +0.8 | +3.4 | +2.2 | −0.9 | −0.2 | +0.5 | +2.7 |
| 4 | −0.4 | −0.9 | −1.3 | +1.1 | +1.4 | +0.8 | +1.1 | +0.9 | +0.3 | −0.3 | −0.1 | +4.0 |
| 5 | −0.6 | −0.4 | −2.6 | +2.0 | −0.5 | +2.1 | +5.5 | +2.6 | +1.9 | +1.0 | +0.9 | +3.5 |
| 6 | −0.5 | +1.5 | −3.4 | +2.6 | +0.5 | +3.4 | +7.2 | +0.8 | +1.8 | +0.7 | +2.4 | +4.3 |
| 7 | +0.1 | +2.8 | −4.1 | +3.7 | −0.1 | +2.9 | +7.8 | +2.1 | +1.8 | −0.2 | +1.8 | +4.8 |
| 8 | −1.0 | +2.3 | −2.8 | +1.8 | −1.0 | +1.6 | +7.4 | +1.3 | +2.5 | −0.5 | +2.0 | +4.7 |
| 9 | −1.2 | +2.9 | −3.0 | 0.0 | +0.8 | +0.8 | +6.0 | +1.6 | +1.5 | −1.6 | +1.5 | +3.2 |
| 10 | −0.7 | +2.7 | −2.7 | +0.1 | 0.0 | +2.2 | +6.5 | +1.4 | +1.9 | −1.7 | +0.8 | +3.9 |
| 11 | +1.2 | +3.8 | −2.6 | −0.6 | −0.1 | +2.0 | +5.4 | +0.5 | 0.0 | −2.0 | +1.2 | +3.1 |
| 12 | +2.2 | +3.0 | −2.5 | +1.1 | +1.1 | +0.3 | +5.9 | +1.3 | +1.8 | −2.0 | +2.7 | +2.7 |
| 13 | +0.7 | +1.5 | −1.8 | −0.4 | +2.0 | +0.4 | +4.6 | +1.1 | +3.2 | −0.2 | +0.9 | +2.4 |
| 14 | +2.5 | +2.0 | −2.5 | −1.4 | 0.0 | −0.7 | +6.7 | +1.0 | +4.0 | +0.1 | −0.5 | +1.0 |
| 15 | +3.2 | +2.8 | −3.5 | −1.0 | +0.4 | −0.6 | +7.1 | −0.6 | +2.8 | −0.4 | +1.1 | 0.0 |
| 16 | +2.5 | +1.6 | −3.8 | +0.7 | +1.5 | +0.4 | +0.3 | −0.4 | +1.2 | −1.1 | +2.4 | +0.6 |
| 17 | +3.6 | +1.4 | −2.6 | +0.1 | +0.1 | +1.3 | +1.4 | +1.0 | +0.5 | −1.2 | +3.2 | +1.3 |
| 18 | +2.8 | 0.0 | −3.1 | +0.5 | +1.3 | +1.2 | 0.0 | +0.6 | +0.9 | −0.2 | +4.1 | +0.9 |
| 19 | +2.8 | −1.2 | −1.7 | +1.3 | +2.3 | +1.7 | 0.0 | +1.8 | −0.8 | 0.0 | +4.4 | +1.8 |
| 20 | +1.8 | −1.5 | −2.4 | +2.7 | +0.9 | −0.2 | +0.4 | +1.8 | −0.1 | +1.5 | +3.1 | +1.2 |
| 21 | −6.6 | −2.5 | −3.4 | +1.2 | +0.6 | +0.7 | −0.7 | +2.3 | +1.7 | +2.1 | +3.0 | +0.5 |
| 22 | −6.7 | −0.8 | −1.8 | +1.6 | +1.6 | +2.0 | −0.3 | +1.6 | +2.9 | +2.1 | +1.9 | +0.3 |
| 23 | −6.5 | −0.3 | −1.5 | −0.2 | +2.3 | +2.7 | −0.6 | +0.9 | +2.4 | +1.1 | +2.4 | +1.7 |
| 24 | −7.2 | −0.4 | −2.5 | −1.7 | +3.3 | +2.3 | +0.9 | +1.2 | +0.4 | +2.7 | +2.8 | +2.4 |
| 25 | −8.7 | +1.1 | −2.7 | −1.2 | +1.3 | +2.4 | +1.4 | +0.1 | −0.5 | +0.6 | +2.9 | +0.9 |
| 26 | −9.2 | +0.9 | −3.5 | −1.0 | +1.9 | +1.0 | +0.4 | −0.1 | +0.2 | −0.1 | +3.6 | +0.5 |
| 27 | −9.1 | −0.1 | −3.1 | −0.8 | +2.8 | +0.5 | +1.8 | +0.5 | +0.7 | +1.4 | +4.3 | +0.1 |
| 28 | −10.7 | −0.7 | −2.4 | +0.9 | +3.9 | +2.2 | +3.2 | +0.2 | +0.3 | 0.0 | +3.2 | +1.4 |
| 29 | −11.4 | −2.3 | +0.5 | +3.6 | +1.3 | +2.4 | +0.8 | −0.5 | −0.6 | +3.6 | +1.2 | |
| 30 | −11.1 | −1.9 | +2.3 | +2.9 | +2.8 | +1.3 | +1.5 | −0.1 | +1.0 | +4.3 | −0.3 | |
| 31 | +0.1 | +0.1 | +3.9 | +0.1 | +1.3 | +0.8 | +0.9 |
Code
@* How far each day's average temperature in Chicago was from its 1991–2020 normal, in °C: a warm spell, a cold snap. *@
<CalendarHeatmap Items="_days" Date="d => d.Day" Value="d => d.Difference"
Palette="ChartPalette.Diverging(Color.Primary, Color.Danger)"
ValueFormat="+0.0;−0.0;0.0" FirstDayOfWeek="DayOfWeek.Monday"
Title="Chicago against normal, 2025 (°C)" />
{
private record DayTemperature(DateOnly Day, double Difference);
private readonly DayTemperature[] _days = Build();
private static DayTemperature[] Build()
{
var start = new DateOnly(2025, 1, 1);
var days = new List<DayTemperature>();
var drift = 0.0;
for (var d = 0; d < 365; d++)
{
// Weather comes in spells: each day keeps most of the day before's difference.
var hash = Math.Sin(d * 12.9898) * 43758.5453;
var kick = (hash - Math.Floor(hash) - 0.5) * 3.5;
drift = 0.8 * drift + kick;
// A cold snap in late January, a hot spell in July.
var spell = d is >= 20 and < 30 ? -9 : d is >= 185 and < 196 ? 6 : 0;
days.Add(new DayTemperature(start.AddDays(d), Math.Round(drift + spell + 0.6, 1)));
}
return [.. days];
}
}Here the weeks start on Monday (FirstDayOfWeek). To compare years, draw one calendar per year with the same Min and Max, so their colors mean the same values.
Details
The range runs from the first item's day to the last's, or From to To. Weeks start on the culture's first day, or FirstDayOfWeek. A day in the range with no item, or a null value, is drawn as no data, never as a zero. The colors are a HeatmapChart's: five even steps from round bounds by default (Steps, Min, Max), a diverging palette's two sides of Midpoint, your own HeatmapRange children, or a continuous blend (Steps 0). The legend is the scale.
Parts
Written inside CalendarHeatmap. The API page lists their parameters.
HeatmapRange: a class of values on aHeatmapChart<T>'s orCalendarHeatmap<T>'s scale, with its own color and name, in place of the chart's even steps:<HeatmapRange From="0" To="10" Color="Color.Of("#dbeafe")" Label="Quiet" />.HeatmapTooltip<TItem>: aHeatmapChart<T>'s orCalendarHeatmap<T>'s tooltip content, in place of the cell's row, column and value:<HeatmapTooltip Context="c">@c.Row, @c.Column: @c.Text orders</HeatmapTooltip>.
Mode support
| Feature | Static | Interactive |
|---|---|---|
| A column per week and a row per weekday, from the culture's first day or one you choose | Yes | Yes |
| Months named along the top, thinning as the calendar narrows | Yes | Yes |
| Days with no data told apart from zeros, and days outside the range left out | Yes | Yes |
| A HeatmapChart's colors: even steps, a diverging scale, named ranges or a blend | Yes | Yes |
| Square days that fit the width | Yes | Yes |
| Legend keys that hide and show the days in their class | Yes | Yes |
| A table of the values, a column per month, in a "Show data" disclosure | Yes | Yes |
| Tooltips on hover and from the keyboard, day by day | Yes | Yes |
Static: static server-side rendering, with no circuit and no WebAssembly. Interactive: Server, WebAssembly or Auto.
Without JavaScript
Every page starts as plain HTML: before IzzyBlazor's script loads on a static page, while an interactive page prerenders, and with JavaScript off.
- Legend keys that hide and show the days in their class: waits for the script
- Tooltips on hover and from the keyboard, day by day: waits for the script
Accessibility
- The chart is a figure captioned by
Title, or named by a heading on the page withTitledBy. - The calendar is one image named by the caption. The legend lists the scale's classes.
- "Show data" under the chart opens the values as a table, a column per month and a row per day of the month (
DataTable). - With script, the calendar is one Tab stop: the arrow keys move from day to day and say each one's date and value.
Keyboard navigation
On the calendar
| Press this key | To do this |
|---|---|
| Down or Up | Move to the next or previous day |
| Right or Left | Move a week later or earlier (reversed on right-to-left pages) |
| Home or End | Go to the first or last day in the row |
| Ctrl+Home or Ctrl+End | Go to the first or last day |
| Escape | Hide the tooltip |
Parameters
| Prop | Type | Default |
|---|---|---|
RefreshHow often the chart reads its data again, at least a second, such as Refresh="TimeSpan.FromSeconds(30)". | TimeSpan? | |
RefreshFromOn a static page with Refresh: a lighter page to fetch than this one, which renders the same chart with the same id. | string? | |
ItemsThe items, a day each: each names its day and its value. | IEnumerable<TItem>? | Required |
DateEach item's day, such as c => c.Day: a DateOnly, DateTime or DateTimeOffset (the time is ignored). | Expression<Func<TItem, object?>> | Required |
ValueEach item's value, such as c => c.Count: any number, or null for no data. | Expression<Func<TItem, object?>> | Required |
FromThe first day shown: the earliest item's day by default. | DateOnly? | |
ToThe last day shown: the latest item's day by default. | DateOnly? | |
FirstDayOfWeekThe day each week's column starts on, at the top: the culture's by default (Sunday in en-US, Monday in most of Europe). | DayOfWeek? | |
TitleThe chart's title, such as "Commits this year", shown above it as its caption. | string? | |
HideTitleHides the title, which still names the chart for screen readers. | bool | false |
DownloadShows a button across from the title that saves the chart as a PNG, named after its title, in the color scheme on screen. | bool | false |
TitleAlignWhere the title sits: at the start by default (the left, in a left-to-right page); ChartAlign.Center or ChartAlign.End. | ChartAlign | ChartAlign.Start |
TitledByThe id of a heading already on the page that titles the chart, such as a card's, in place of Title: the chart takes its name from it and shows no title of its own. | string? | |
ValueFormatA .NET format string for the values, such as N0 or P0: in the legend, the tooltips and the table. | string? | |
PaletteThe colors: Shades of the primary color by default, light to dark for low to high; Shades of another color; Diverging for values above and below Midpoint, such as each day's temperature against normal; or your own ramp with Of, one class per color. | ChartPalette? | |
StepsHow many classes the values fall into, each a shade: 5 by default, 2 to 9, even steps between round bounds around the values (or from Min to Max). | int | 5 |
MidpointThe value a Diverging scale turns at, gray in the middle: 0 by default. | double? | |
MinThe scale's low end, so calendars side by side, such as one per year, share a scale. | double? | |
MaxThe scale's high end. | double? | |
CellSizeThe largest a day grows to: 2rem by default. | Length? | |
LegendWhere the legend, the color scale, goes: above the calendar by default (ChartLegend.Auto or ChartLegend.Top), ChartLegend.Bottom, or upright beside it with ChartLegend.Start or ChartLegend.End (above it under 30rem); ChartLegend.None leaves it out. | ChartLegend | ChartLegend.Auto |
LegendAlignThe legend's place along its edge: the start by default, the center or the end. | ChartAlign? | |
TooltipThe tooltip for the day under the pointer or the keyboard (with script), beside its cell: on by default. | bool | true |
DataTableThe values as a table, a column per month and a row per day of the month: by default behind a "Show data" button that opens it over the chart; ChartDataTable.Collapsed puts it in a disclosure under the chart. | ChartDataTable | ChartDataTable.Popover |
ChildContentHeatmapRanges, your own classes, and a HeatmapTooltip<T> (its Date the day, Column the day as text, Row the weekday). | RenderFragment? | |
OnRefreshOn an interactive page with Refresh: raised at each interval, to load new data. | EventCallback |
Plus 17 item props and 4 common props.
Full APISee also
- HeatmapChart: shows where values run high or low across two dimensions, such as the busiest hours of the week.
- Chart: draws a chart on the server from a list of items, with axes, value labels, reference lines, trends and a table of the values, for every chart type.