Skip to content
ConsoleMonster
Class

Matrix

ConsoleMonster.Widgets

Namespace
ConsoleMonster.Widgets
Assembly
ConsoleMonster
Implements
IWidget
Modifiers
sealed

A labelled status grid with contiguous axis bands, a counted legend and explicit narrow fallbacks.

Inheritance

  • object
  • Matrix

Usage

Explore 83 API references to this type

This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.

Returned or exposed by 41

Accepted by parameters 42

Constructors

public Matrix(IEnumerable<MatrixLabel> rows, IEnumerable<MatrixLabel> columns) #

Creates a matrix with fixed axes; labels and cells contain plain text.

Parameters

rows System.Collections.Generic.IEnumerable<ConsoleMonster.Widgets.MatrixLabel> required
The row labels.
columns System.Collections.Generic.IEnumerable<ConsoleMonster.Widgets.MatrixLabel> required
The column labels.

Methods

public MatrixCell? GetCell(int row, int column) #

Gets an observation, or null when none has been supplied.

Parameters

row int required
Zero-based row index.
column int required
Zero-based column index.

Returns

MatrixCell? The observation.
public Size Measure(Constraints constraints, RenderContext context) #

Returns the size the widget wants within the constraints.

Parameters

constraints ConsoleMonster.Layout.Constraints required
The space offered.
context ConsoleMonster.Canvas.RenderContext required
Profile, theme and glyphs.

Returns

Size The desired size, never larger than the constraints.
public void Render(Region region, RenderContext context) #

Renders into a region. The region may be smaller or larger than the measured size.

Parameters

region ConsoleMonster.Canvas.Region required
The target region.
context ConsoleMonster.Canvas.RenderContext required
Profile, theme and glyphs.
SetCell 2 overloads
public Matrix SetCell(int row, int column, StatusKind? status, string? text = null, bool diagonal = false) #

Sets an observation without deriving health or assuming the axes describe the same entities.

Parameters

row int required
Zero-based row index.
column int required
Zero-based column index.
status ConsoleMonster.Styling.StatusKind? required
The supplied status, or null.
text string? = null optional
Optional short plain text.
diagonal bool = false optional
True for an explicit self marker.

Returns

Matrix This matrix.
public Matrix SetCell(int row, int column, StatusKind? status, string? text, string? marker, bool diagonal = false) #

Sets an observation with a literal marker independent of its supplied status and tone.

Parameters

row int required
Zero-based row index.
column int required
Zero-based column index.
status ConsoleMonster.Styling.StatusKind? required
The supplied status, or null.
text string? required
Optional short plain text.
marker string? required
A literal marker; null retains the built-in glyph. Explicit self cells retain their self marker.
diagonal bool = false optional
True for an explicit self marker.

Returns

Matrix This matrix.

Properties

public IReadOnlyList<MatrixLabel> Rows { get; } #

The row labels in input order.

public IReadOnlyList<MatrixLabel> Columns { get; } #

The column labels in input order.

public string? Title { get; set; } #

An optional markup title.

public string? RowAxisCaption { get; set; } #

An optional plain text caption for the row axis, shown in grids and attention lists.

public string? ColumnAxisCaption { get; set; } #

An optional plain text caption for the column axis, shown in grids and attention lists.

public string? ListDirection { get; set; } #

An optional literal connector between row and column identities in lists; null retains a slash.

public string? AsciiListDirection { get; set; } #

The ASCII connector for Matrix.ListDirection; null uses that connector unchanged.

public IDictionary<StatusKind, string> LegendLabels { get; } #

Optional plain text legend words keyed by supplied status; absent entries retain the built-in words.

public IDictionary<StatusKind, string> LegendMarkers { get; } #

Optional literal legend glyphs keyed by status; absent entries retain the built-in glyphs. These do not change cell glyphs or counts. Use ASCII-safe glyphs for all-tier output.

public IDictionary<StatusKind, ThemeToken> LegendRoles { get; } #

Optional semantic roles for caller-labelled matrix states.

public IList<string> AdditionalLegendEntries { get; } #

Additional markup legend entries for evidence not assignable to a cell.

public string? SelfLegendLabel { get; set; } #

The plain text self-cell legend word, or null for the built-in word.

public string? MissingLegendLabel { get; set; } #

The plain text absent-observation legend word, or null for the built-in word.

public bool ShowLegend { get; set; } #

Show counts of supplied statuses, self cells and absent observations (default true).

public bool ShowLegendCounts { get; set; } #

Include observed cell counts after state labels in an inline legend (default true).

public bool InlineAxes { get; set; } #

Use inline axis captions, a left band column and the full/short/numbered fit chain.

public int MinCellWidth { get; set; } #

Minimum cell width for an inline grid (default one).

public string? ShortRowAxisCaption { get; set; } #

Abbreviated row caption for numbered grids.

public string? ShortColumnAxisCaption { get; set; } #

Abbreviated column caption for numbered grids.

public string? CellNote { get; set; } #

An optional literal explanation of what each cell contains.

public bool NonHealthyOnly { get; set; } #

Always render the non-healthy list instead of the grid.

public int MaxGridSize { get; set; } #

The largest axis allowed in grid mode (default 16). Larger axes use the attention list.

public int MaxListRows { get; set; } #

The most attention entries shown (default 10; zero shows all), followed by an omission count.

public Func<StatusKind?, bool>? IsHealthy { get; set; } #

Classifies supplied statuses for the attention list; null uses Pass, Skip and absent as healthy.

Extension Methods

AddAdditionalLegendEntries 2 overloads
public static Matrix AddAdditionalLegendEntries(Matrix matrix, params string[] items) #

Adds items to Matrix.AdditionalLegendEntries: Additional markup legend entries for evidence not assignable to a cell.

Parameters

matrix ConsoleMonster.Widgets.Matrix required
The instance.
items string[] required
The items, in order.

Returns

Matrix The same instance.
public static Matrix AddAdditionalLegendEntries(Matrix matrix, IEnumerable<string> items) #

Adds items to Matrix.AdditionalLegendEntries: Additional markup legend entries for evidence not assignable to a cell.

Parameters

matrix ConsoleMonster.Widgets.Matrix required
The instance.
items System.Collections.Generic.IEnumerable<string> required
The items, in order.

Returns

Matrix The same instance.
public static Matrix AddAdditionalLegendEntry(Matrix matrix, string item) #

Adds an item to Matrix.AdditionalLegendEntries: Additional markup legend entries for evidence not assignable to a cell.

Parameters

matrix ConsoleMonster.Widgets.Matrix required
The instance.
item string required
The item.

Returns

Matrix The same instance.
public static Matrix AsciiListDirection(Matrix matrix, string? value) #

Sets Matrix.AsciiListDirection: The ASCII connector for Matrix.ListDirection; null uses that connector unchanged.

Parameters

matrix ConsoleMonster.Widgets.Matrix required
The instance.
value string? required
The value.

Returns

Matrix The same instance.

Examples

// C# initializer or property         // C# fluent
matrix.AsciiListDirection = value;    matrix.AsciiListDirection(value);
public static Matrix CellNote(Matrix matrix, string? value) #

Sets Matrix.CellNote: An optional literal explanation of what each cell contains.

Parameters

matrix ConsoleMonster.Widgets.Matrix required
The instance.
value string? required
The value.

Returns

Matrix The same instance.

Examples

// C# initializer or property    // C# fluent
matrix.CellNote = value;         matrix.CellNote(value);
public static Matrix ColumnAxisCaption(Matrix matrix, string? value) #

Sets Matrix.ColumnAxisCaption: An optional plain text caption for the column axis, shown in grids and attention lists.

Parameters

matrix ConsoleMonster.Widgets.Matrix required
The instance.
value string? required
The value.

Returns

Matrix The same instance.

Examples

// C# initializer or property        // C# fluent
matrix.ColumnAxisCaption = value;    matrix.ColumnAxisCaption(value);
public static Matrix Configure(Matrix matrix, Action<Matrix> configure) #

Assigns callbacks and related configuration without invoking delegate-valued properties.

Parameters

matrix ConsoleMonster.Widgets.Matrix required
The instance.
configure System.Action<ConsoleMonster.Widgets.Matrix> required
Assignments applied in order.

Returns

Matrix The same instance.

Examples

// C# initializer or property    // C# fluent
matrix.IsHealthy = value;        matrix.Configure(configured => configured.IsHealthy = value);
InlineAxes 2 overloads
public static Matrix InlineAxes(Matrix matrix, bool value) #

Sets Matrix.InlineAxes: Use inline axis captions, a left band column and the full/short/numbered fit chain.

Parameters

matrix ConsoleMonster.Widgets.Matrix required
The instance.
value bool required
The value.

Returns

Matrix The same instance.

Examples

// C# initializer or property    // C# fluent
matrix.InlineAxes = value;       matrix.InlineAxes(value);
public static Matrix InlineAxes(Matrix matrix) #

Sets Matrix.InlineAxes to true.

Parameters

matrix ConsoleMonster.Widgets.Matrix required
The instance to configure.

Returns

Matrix The same instance.
public static Matrix ListDirection(Matrix matrix, string? value) #

Sets Matrix.ListDirection: An optional literal connector between row and column identities in lists; null retains a slash.

Parameters

matrix ConsoleMonster.Widgets.Matrix required
The instance.
value string? required
The value.

Returns

Matrix The same instance.

Examples

// C# initializer or property    // C# fluent
matrix.ListDirection = value;    matrix.ListDirection(value);
public static Matrix MaxGridSize(Matrix matrix, int value) #

Sets Matrix.MaxGridSize: The largest axis allowed in grid mode (default 16). Larger axes use the attention list.

Parameters

matrix ConsoleMonster.Widgets.Matrix required
The instance.
value int required
The value.

Returns

Matrix The same instance.

Examples

// C# initializer or property    // C# fluent
matrix.MaxGridSize = value;      matrix.MaxGridSize(value);
public static Matrix MaxListRows(Matrix matrix, int value) #

Sets Matrix.MaxListRows: The most attention entries shown (default 10; zero shows all), followed by an omission count.

Parameters

matrix ConsoleMonster.Widgets.Matrix required
The instance.
value int required
The value.

Returns

Matrix The same instance.

Examples

// C# initializer or property    // C# fluent
matrix.MaxListRows = value;      matrix.MaxListRows(value);
public static Matrix MinCellWidth(Matrix matrix, int value) #

Sets Matrix.MinCellWidth: Minimum cell width for an inline grid (default one).

Parameters

matrix ConsoleMonster.Widgets.Matrix required
The instance.
value int required
The value.

Returns

Matrix The same instance.

Examples

// C# initializer or property    // C# fluent
matrix.MinCellWidth = value;     matrix.MinCellWidth(value);
public static Matrix MissingLegendLabel(Matrix matrix, string? value) #

Sets Matrix.MissingLegendLabel: The plain text absent-observation legend word, or null for the built-in word.

Parameters

matrix ConsoleMonster.Widgets.Matrix required
The instance.
value string? required
The value.

Returns

Matrix The same instance.

Examples

// C# initializer or property         // C# fluent
matrix.MissingLegendLabel = value;    matrix.MissingLegendLabel(value);
NonHealthyOnly 2 overloads
public static Matrix NonHealthyOnly(Matrix matrix, bool value) #

Sets Matrix.NonHealthyOnly: Always render the non-healthy list instead of the grid.

Parameters

matrix ConsoleMonster.Widgets.Matrix required
The instance.
value bool required
The value.

Returns

Matrix The same instance.

Examples

// C# initializer or property     // C# fluent
matrix.NonHealthyOnly = value;    matrix.NonHealthyOnly(value);
public static Matrix NonHealthyOnly(Matrix matrix) #

Sets Matrix.NonHealthyOnly to true.

Parameters

matrix ConsoleMonster.Widgets.Matrix required
The instance to configure.

Returns

Matrix The same instance.
public static Matrix RowAxisCaption(Matrix matrix, string? value) #

Sets Matrix.RowAxisCaption: An optional plain text caption for the row axis, shown in grids and attention lists.

Parameters

matrix ConsoleMonster.Widgets.Matrix required
The instance.
value string? required
The value.

Returns

Matrix The same instance.

Examples

// C# initializer or property     // C# fluent
matrix.RowAxisCaption = value;    matrix.RowAxisCaption(value);
public static Matrix SelfLegendLabel(Matrix matrix, string? value) #

Sets Matrix.SelfLegendLabel: The plain text self-cell legend word, or null for the built-in word.

Parameters

matrix ConsoleMonster.Widgets.Matrix required
The instance.
value string? required
The value.

Returns

Matrix The same instance.

Examples

// C# initializer or property      // C# fluent
matrix.SelfLegendLabel = value;    matrix.SelfLegendLabel(value);
public static Matrix ShortColumnAxisCaption(Matrix matrix, string? value) #

Sets Matrix.ShortColumnAxisCaption: Abbreviated column caption for numbered grids.

Parameters

matrix ConsoleMonster.Widgets.Matrix required
The instance.
value string? required
The value.

Returns

Matrix The same instance.

Examples

// C# initializer or property             // C# fluent
matrix.ShortColumnAxisCaption = value;    matrix.ShortColumnAxisCaption(value);
public static Matrix ShortRowAxisCaption(Matrix matrix, string? value) #

Sets Matrix.ShortRowAxisCaption: Abbreviated row caption for numbered grids.

Parameters

matrix ConsoleMonster.Widgets.Matrix required
The instance.
value string? required
The value.

Returns

Matrix The same instance.

Examples

// C# initializer or property          // C# fluent
matrix.ShortRowAxisCaption = value;    matrix.ShortRowAxisCaption(value);
ShowLegend 2 overloads
public static Matrix ShowLegend(Matrix matrix, bool value) #

Sets Matrix.ShowLegend: Show counts of supplied statuses, self cells and absent observations (default true).

Parameters

matrix ConsoleMonster.Widgets.Matrix required
The instance.
value bool required
The value.

Returns

Matrix The same instance.

Examples

// C# initializer or property    // C# fluent
matrix.ShowLegend = value;       matrix.ShowLegend(value);
public static Matrix ShowLegend(Matrix matrix) #

Sets Matrix.ShowLegend to true.

Parameters

matrix ConsoleMonster.Widgets.Matrix required
The instance to configure.

Returns

Matrix The same instance.
ShowLegendCounts 2 overloads
public static Matrix ShowLegendCounts(Matrix matrix, bool value) #

Sets Matrix.ShowLegendCounts: Include observed cell counts after state labels in an inline legend (default true).

Parameters

matrix ConsoleMonster.Widgets.Matrix required
The instance.
value bool required
The value.

Returns

Matrix The same instance.

Examples

// C# initializer or property       // C# fluent
matrix.ShowLegendCounts = value;    matrix.ShowLegendCounts(value);
public static Matrix ShowLegendCounts(Matrix matrix) #

Sets Matrix.ShowLegendCounts to true.

Parameters

matrix ConsoleMonster.Widgets.Matrix required
The instance to configure.

Returns

Matrix The same instance.
public static Matrix Title(Matrix matrix, string? value) #

Sets Matrix.Title: An optional markup title.

Parameters

matrix ConsoleMonster.Widgets.Matrix required
The instance.
value string? required
The value.

Returns

Matrix The same instance.

Examples

// C# initializer or property    // C# fluent
matrix.Title = value;            matrix.Title(value);