Skip to content
ConsoleMonster

API Reference

Class

StackedBar

Namespace ConsoleMonster.Widgets
Assembly ConsoleMonster
Implements
Modifiers sealed

One bar split into proportional segments with a legend (label, value, share). Segments labelled with a status word (Passed, Failed, Warnings, Skipped...) take that status colour unless a token is given. Without colour, segments use distinct fill glyphs so the split stays readable. Live operations (Key = segment): set (Value), add (Value).

Inheritance

Usage

Explore 21 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.

Accepted by parameters 10

Constructors

public StackedBar(String name = "stacked") #

Creates a stacked bar.

Parameters

name System.String = "stacked" optionalposition: 0
The live name (default stacked).

Methods

Add 2 overloads
public StackedBar Add(RichText label, Double value, ThemeToken? token = null) #
Returns: StackedBar

Adds or updates a segment with a multicolour legend label (its plain text is the key).

Parameters

label ConsoleMonster.Text.RichText requiredposition: 0
The rich label.
value System.Double requiredposition: 1
The value.
token ConsoleMonster.Styling.ThemeToken? = null optionalposition: 2
The colour token, or null for the next series colour.

Returns

This instance.

public StackedBar Add(String label, Double value, ThemeToken? token = null) #
Returns: StackedBar

Adds or updates a segment.

Parameters

label System.String requiredposition: 0
The label.
value System.Double requiredposition: 1
The value.
token ConsoleMonster.Styling.ThemeToken? = null optionalposition: 2
The colour token, or null for the next series colour.

Returns

This instance.

public override Void Apply(LiveEvent liveEvent) #
Returns: Void

Applies an event to the widget's state.

Parameters

liveEvent ConsoleMonster.Live.LiveEvent requiredposition: 0
The event.
public override Size Measure(Constraints constraints, RenderContext context) #
Returns: Size

Returns the size the widget wants within the constraints.

Parameters

constraints ConsoleMonster.Layout.Constraints requiredposition: 0
The space offered.
context ConsoleMonster.Canvas.RenderContext requiredposition: 1
Profile, theme and glyphs.

Returns

The desired size, never larger than the constraints.

public override Void Render(Region region, RenderContext context) #
Returns: Void

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

Parameters

region ConsoleMonster.Canvas.Region requiredposition: 0
The target region.
context ConsoleMonster.Canvas.RenderContext requiredposition: 1
Profile, theme and glyphs.

Properties

public IReadOnlyList<ChartItem> Segments { get; } #

The segments.

public Boolean ShowLegend { get; set; } #

Whether the legend line is shown (default true).

public Int32 MaxLegendColumns { get; set; } #

The most legend columns per row, or 0 (default) to fit as many as the width allows. Entries fill rows left to right and every row shares one grid, so labels, counts and percentages line up.

public ColumnFormat LabelColumn { get; set; } #

Layout of the legend label column (default left-aligned).

public ColumnFormat CountColumn { get; set; } #

Layout of the legend count column (default right-aligned; reserves the digits of the overall total).

public ColumnFormat PercentColumn { get; set; } #

Layout of the legend percentage column (default right-aligned, four cells).

Extension Methods

WithCountColumn 2 overloads
public static StackedBar WithCountColumn(StackedBar stackedBar, ColumnFormat value) #
Returns: StackedBar

Sets StackedBar.CountColumn: Layout of the legend count column (default right-aligned; reserves the digits of the overall total).

Parameters

stackedBar ConsoleMonster.Widgets.StackedBar requiredposition: 0
The instance.
value ConsoleMonster.Layout.ColumnFormat requiredposition: 1
The value.

Returns

The same instance.

public static StackedBar WithCountColumn(StackedBar stackedBar, Action<ColumnFormat> configure) #
Returns: StackedBar

Configures StackedBar.CountColumn in place: Layout of the legend count column (default right-aligned; reserves the digits of the overall total).

Parameters

stackedBar ConsoleMonster.Widgets.StackedBar requiredposition: 0
The instance.
configure System.Action<ConsoleMonster.Layout.ColumnFormat> requiredposition: 1
Configures the value.

Returns

The same instance.

WithLabelColumn 2 overloads
public static StackedBar WithLabelColumn(StackedBar stackedBar, ColumnFormat value) #
Returns: StackedBar

Sets StackedBar.LabelColumn: Layout of the legend label column (default left-aligned).

Parameters

stackedBar ConsoleMonster.Widgets.StackedBar requiredposition: 0
The instance.
value ConsoleMonster.Layout.ColumnFormat requiredposition: 1
The value.

Returns

The same instance.

public static StackedBar WithLabelColumn(StackedBar stackedBar, Action<ColumnFormat> configure) #
Returns: StackedBar

Configures StackedBar.LabelColumn in place: Layout of the legend label column (default left-aligned).

Parameters

stackedBar ConsoleMonster.Widgets.StackedBar requiredposition: 0
The instance.
configure System.Action<ConsoleMonster.Layout.ColumnFormat> requiredposition: 1
Configures the value.

Returns

The same instance.

public static StackedBar WithMaxLegendColumns(StackedBar stackedBar, Int32 value) #
Returns: StackedBar

Sets StackedBar.MaxLegendColumns: The most legend columns per row, or 0 (default) to fit as many as the width allows. Entries fill rows left to right and every row shares one grid, so labels, counts and percentages line up.

Parameters

stackedBar ConsoleMonster.Widgets.StackedBar requiredposition: 0
The instance.
value System.Int32 requiredposition: 1
The value.

Returns

The same instance.

WithPercentColumn 2 overloads
public static StackedBar WithPercentColumn(StackedBar stackedBar, ColumnFormat value) #
Returns: StackedBar

Sets StackedBar.PercentColumn: Layout of the legend percentage column (default right-aligned, four cells).

Parameters

stackedBar ConsoleMonster.Widgets.StackedBar requiredposition: 0
The instance.
value ConsoleMonster.Layout.ColumnFormat requiredposition: 1
The value.

Returns

The same instance.

public static StackedBar WithPercentColumn(StackedBar stackedBar, Action<ColumnFormat> configure) #
Returns: StackedBar

Configures StackedBar.PercentColumn in place: Layout of the legend percentage column (default right-aligned, four cells).

Parameters

stackedBar ConsoleMonster.Widgets.StackedBar requiredposition: 0
The instance.
configure System.Action<ConsoleMonster.Layout.ColumnFormat> requiredposition: 1
Configures the value.

Returns

The same instance.

public static StackedBar WithShowLegend(StackedBar stackedBar, Boolean value = true) #
Returns: StackedBar

Sets StackedBar.ShowLegend: Whether the legend line is shown (default true).

Parameters

stackedBar ConsoleMonster.Widgets.StackedBar requiredposition: 0
The instance.
value System.Boolean = true optionalposition: 1
The value (default true).

Returns

The same instance.