HeatmapCalendar
Namespace: Wisej.Web
Assembly: Wisej.Framework (4.2.0.0)
Displays daily values as a contribution calendar with week columns and seven day rows.
- C#
- VB.NET
public class HeatmapCalendar : Control
Public Class HeatmapCalendar
Inherits Control
Dates retain their calendar date without time-zone conversion. Duplicate dates are summed. Missing dates have zero value. Nonnegative values are divided into Levels intensity bands, including the zero band, relative to the largest value in the displayed range. Bound lists with change notifications refresh automatically; call RefreshData for other sources.
Example:
var calendar = new HeatmapCalendar { Tone = MeterTone.Success };
calendar.SetDateRange(new DateTime(2026, 4, 1), new DateTime(2026, 9, 30));
calendar.DataSource = new[] { new { Date = new DateTime(2026, 4, 2), Value = 12d } };
calendar.CellClick += (sender, e) => MessageBox.Show($"{e.Date:d}: {e.Value}");
this.Controls.Add(calendar);
Constructors
HeatmapCalendar()
Initializes a calendar showing the current year with five intensity levels.
Properties
CellRadius
Int32: Gets or sets the cell corner radius in pixels, capped visually at half the cell size. (Default: 3)
CellSize
Int32: Gets or sets the square cell size in pixels, from 4 through 64. (Default: 12)
DataSource
Object: Gets or sets an enumerable source, IListSource, or BindingSource containing daily records. (Default: null)
DateMember and ValueMember default to Date and Value. Date values must be DateTime, DateTimeOffset, or DateOnly on .NET 6 and later. Null records and dates are ignored; null values count as zero. Values must be finite and nonnegative. An invalid assignment leaves the previous source intact.
DateMember
String: Gets or sets the record property containing the calendar date. (Default: "Date")
DefaultSize
Size: Gets the default calendar size.
EndDate
DateTime: Gets or sets the inclusive last date. The default is the last day of the current year.
Time and DateTimeKind are discarded. Use SetDateRange to change both endpoints atomically. Ranges are limited to 3,660 days to keep rendering and interaction bounded.
Levels
Int32: Gets or sets the number of intensity bands, including zero, from 2 through 10. (Default: 5)
ShowDayLabels
Boolean: Gets or sets whether to display Monday, Wednesday, and Friday labels beside the rows. (Default: True)
ShowMonthLabels
Boolean: Gets or sets whether to display abbreviated month names above week columns. (Default: True)
StartDate
DateTime: Gets or sets the inclusive first date. The default is the first day of the current year.
Time and DateTimeKind are discarded. Use SetDateRange to change both endpoints atomically. Ranges are limited to 3,660 days to keep rendering and interaction bounded.
Tone
MeterTone: Gets or sets the semantic color used for positive values. (Default: Success)
ToolTipFormat
String: Gets or sets the composite tooltip format using date {0} and summed value {1}. (Default: "{0:d}: {1:N0}")
Formatting uses the current culture. Text is escaped on the client and never interpreted as HTML.
Example:
calendar.ToolTipFormat = "{0:ddd, dd MMM}: {1:N0} deployments";
ValueMember
String: Gets or sets the record property containing the nonnegative numeric value. (Default: "Value")
Methods
Dispose(disposing)
Detaches source notifications when the control is disposed.
| Parameter | Type | Description |
|---|---|---|
| disposing | Boolean | Whether managed resources can be released. |
OnCellClick(e)
Raises the CellClick event with authoritative server data.
| Parameter | Type | Description |
|---|---|---|
| e | HeatmapCellEventArgs | Event data. |
OnCellHover(e)
Raises the CellHover event with authoritative server data.
| Parameter | Type | Description |
|---|---|---|
| e | HeatmapCellEventArgs | Event data. |
OnRangeSelected(e)
Raises the RangeSelected event with authoritative server data.
| Parameter | Type | Description |
|---|---|---|
| e | HeatmapRangeEventArgs | Event data. |
OnWebEvent(e)
Dispatches client events to validation and processing methods.
| Parameter | Type | Description |
|---|---|---|
| e | WisejEventArgs | Client event and payload. |
OnWebRender(config)
Serializes a calendar snapshot and wires its normal events unconditionally.
| Parameter | Type | Description |
|---|---|---|
| config | Object | Client configuration. |
RefreshData()
Re-reads the current source. Call after modifying sources without change notifications.
An invalid record causes an exception and preserves the last valid displayed snapshot.
SetDateRange(start, end)
Atomically sets the inclusive date range and rebuilds daily values.
| Parameter | Type | Description |
|---|---|---|
| start | DateTime | First calendar date. |
| end | DateTime | Last calendar date, at most 3,659 days after start. |
Throws:
- ArgumentOutOfRangeException The range is reversed or exceeds 3,660 days.
Events
CellClick
EventHandler<HeatmapCellEventArgs> Occurs when a day is clicked or activated with Enter or Space.
CellHover
EventHandler<HeatmapCellEventArgs> Occurs when the pointer enters a different day.
RangeSelected
EventHandler<HeatmapRangeEventArgs> Occurs when a date range is selected by dragging or Shift plus an arrow key.
Implements
| Name | Description |
|---|---|
| IUserData | Provides access to the UserData and Tag properties associated to the component implementing this interface. |
| IBindableComponent | Bindable components implement this interface. |
| IDropTarget | Controls that support drag & drop operations implement this interface. |
| IWisejComponent | All wisej components implement this interface. |
| IWisejControl | All wisej controls derived from the Control class must implement this interface. |
| IWisejSerializable | Allows an object to serialize itself. |