calendar component provides a calendar-based coordinate system for visualizing data distributed across days, weeks, and months. Perfect for activity heatmaps, contribution calendars, and temporal patterns.
When to Use
Use the calendar coordinate system when you need to:- Display daily activity levels or metrics (like GitHub contribution graphs)
- Visualize seasonal patterns and trends
- Show event distributions across months
- Create heatmaps of time-based data
- Track habits, attendance, or daily statistics
Basic Configuration
Multiple Calendars
Display multiple years or date ranges:Vertical Layout
Create a vertical calendar orientation:Customized Date Range
Specify a specific date range:Properties
The date range for the calendar. Can be:
- A year:
2024or'2024' - A month:
'2024-03' - A date range:
['2024-01-01', '2024-12-31']
['2024-01', '2024-02'], they will be identified as ['2024-01-01', '2024-02-01'].Source: CalendarModel.ts:90Size of each calendar cell. Can be:
- A single number: both width and height
'auto': automatically calculated- An array:
[width, height]
width or both left and right, cellSize will automatically be set to ‘auto’.Source: CalendarModel.ts:71, 201Layout orientation of the calendar.Source:
CalendarModel.ts:72, 204Distance from the left side of the container.Source:
CalendarModel.ts:198Distance from the top of the container.Source:
CalendarModel.ts:199Style for month separator lines.Source:
CalendarModel.ts:74-77, 207-214Whether to show split lines.
Line style configuration:
color: Line color (default:tokens.color.axisLine)width: Line width (default: 1)type: Line type (default: ‘solid’)
Style for calendar cells (rectangles).Source:
CalendarModel.ts:79, 217-221Default values:color:tokens.color.neutral00borderWidth: 1borderColor:tokens.color.neutral10
Configuration for day-of-week labels.Source:
CalendarModel.ts:92-117, 224-233Whether to show day labels.
First day of the week. 0 = Sunday, 1 = Monday, etc.
Margin between day label and axis line. Can be percent string of cell size.
Position of week labels, at the beginning or end of the range.
Week text content. Defaults to auto-detected locale or can be:
- A locale name (case-sensitive):
'en','zh' - Custom array:
['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'](index 0 is Sunday)
Text color for day labels.
Configuration for month labels.Source:
CalendarModel.ts:119-140, 236-248Whether to show month labels.
Margin between month label and axis line.
Position of month labels.
Alignment of month text.
Month text content. Defaults to auto-detected locale or can be:
- A locale name:
'en','zh' - Custom array:
['Jan', 'Feb', ..., 'Dec'](index 0 is January)
Month label formatter. Receives parameters:
nameMap: Month nameyyyy: Full year (4 digits)yy: Short year (2 digits)MM: Month number with 0 prefixM: Month number
Text color for month labels.
Configuration for year labels.Source:
CalendarModel.ts:142-154, 251-262Whether to show year labels.
Margin between year label and axis line.
Position of year labels. Defaults to null (auto-positioned).
Year label formatter. Receives parameters:
nameMap: Year namestart: Start yearend: End year
Text color for year labels.
Font family for year labels.
Font weight for year labels.
Font size for year labels.
z-index of the component. Set to 2 to prevent series from appearing on top of borders.Source:
CalendarModel.ts:197Implementation Details
The CalendarModel class extends ComponentModel and implementsCoordinateSystemHostModel. Key implementation details from CalendarModel.ts:
Cell Size Normalization
ThecellSize property is normalized to always be an array of two values [width, height] (source: CalendarModel.ts:267-281):
- Single values are duplicated:
20→[20, 20] - If
widthor bothleftandrightare set, cellSize width becomes'auto' - If
heightor bothtopandbottomare set, cellSize height becomes'auto'
Layout Mode
The calendar uses box layout mode (source:CalendarModel.ts:163), which means it supports standard box layout parameters like left, top, right, bottom, width, and height.
Date Range Parsing
Therange option accepts flexible formats (source: CalendarModel.ts:82-90):
- A single year is treated as the full year
- A month string is treated as that full month
- An array defines start and end dates
- Month-only formats in arrays are normalized to the first day of each month
Related Components
- Heatmap Chart - Perfect for calendar-based heatmaps
- Scatter Chart - Can be used with calendar coordinates
- Visual Map - For mapping data values to colors in calendar heatmaps