MatrixChart
Generic x/y heatmap with categorical axes
Source
LLM docs
Docs
Package
Usage
MatrixChart is a generic x/y heatmap with categorical axes. Each cell is colored based on a value.
Data is an array of objects with x, y, and value properties.
Data format
Data is an array of MatrixChartCell objects:
x– column identifiery– row identifiervalue– numeric value for color interpolation,nullfor empty cells
Labels
Set withXLabels and withYLabels to display axis labels. By default, labels are taken
from x and y values of data. Use xLabels and yLabels props to change them and
xLabelsPosition="top" to display x-axis labels above the chart.
X-axis labels rotation
By default, x-axis labels are rotated -90 degrees. Use xLabelsRotation prop to change the angle.
Set it to 0 for horizontal labels or -45 for angled labels.
Tooltip
Set withTooltip prop and provide getTooltipLabel function to display a tooltip on cell hover.
Colors
Use colors prop to customize the color palette. Colors are interpolated based on the cell value
within the domain range.
Values domain
By default, domain is auto-calculated from data min/max values. Use domain prop to set
a custom [min, max] range for color interpolation.
Cell size and gap
Use cellSize and gap props to control cell dimensions and spacing. cellRadius controls
the border radius of cells.
Pass props to cells
Use getCellProps callback to add custom props to individual cells based on their data.
Legend
Set withLegend prop to display a color legend below the chart. Use legendLabels prop
to customize the legend text.
Accessibility
Cells are not announced by screen readers. Set aria-label or aria-labelledby
to describe what the chart shows: