Skip to main content

Matrix chart

info

Charts are available with Avalonia Pro.

Matrix charts use a grid to visualize boolean relationships between two categorical sets. They are a good fit for showing whether a feature, status, or permission is present at the intersection of rows and columns.

Matrix chart showing a grid of dots sized or colored by value at row and column intersections.

When to use

  • Correlation tables: Showing the relationship between many different variables.
  • Schedule overviews: Mapping availability or events across people and days.
  • Attribute comparison: Visualizing which features (columns) apply to which products (rows).

Code example

XAML

<charts:MatrixChart Title="Fruit Attributes" Height="300"
ItemsSource="{Binding MatrixData}"
ColumnLabels="{Binding MatrixColumns}"
RowLabelPath="Attribute" ValuesPath="Values"
CellSize="28" CellGap="25"/>

Data model (C#)

public record MatrixItem(string Attribute, bool[] Values);

public ObservableCollection<string> MatrixColumns { get; } = new()
{
"Grape", "Banana", "Orange", "Apple"
};

public ObservableCollection<MatrixItem> MatrixData { get; } = new()
{
new("Good for juicing", new[] { false, true, true, true }),
new("Good for smoothies", new[] { true, true, false, true }),
new("Good for baking", new[] { true, false, true, true }),
new("Good for jam", new[] { true, false, false, true }),
new("Good for salads", new[] { true, false, true, true })
};

Common properties

PropertyDescriptionDefault
ItemsSourceThe collection of row data.null
RowLabelPathPath to the row label property.null
ColumnLabelsThe list of column labels shown across the top.null
ValuesPathPath to the boolean values for the row's cells.null
CellSizeThe diameter of each matrix cell.30.0
CellGapThe gap between cells.2.0
TrueBrushBrush used for true values.null
FalseBrushBrush used for false values.null
ShowFilledCirclesWhether true values are filled instead of outlined.true
ShowRowLabelsWhether to display labels for each row.true
ShowColumnLabelsWhether to display labels for each column.true
LabelFontSizeFont size used for row and column labels.11.0
IsHighlightEnabledEnables hover highlighting for matrix cells.false