Skip to content
ConsoleMonster
Class

ScatterPlot

ConsoleMonster.Widgets

Namespace
ConsoleMonster.Widgets
Assembly
ConsoleMonster
Modifiers
sealed

Points placed by two values, such as the time each item of a run took against the order it finished in. With colour, points are braille dots (2x4 per cell) on Full, half blocks on Basic and characters on Ascii, each in its own role, so a status role shows which points failed. Without colour, a point with a status role shows that status symbol and other points *. An accessible profile lists the values as text instead: problem points one by one, the others as a count and range. The y axis carries its top and bottom values; ScatterPlot.StartLabel and ScatterPlot.EndLabel name the ends of the x axis. Live operation: add (Value = y, Key = x or empty for the next position, State = an optional status word for the role).

Inheritance

Usage

Explore 38 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 18

Constructors

public ScatterPlot(string widgetId = "scatter") #

Creates a scatter plot.

Parameters

widgetId string = "scatter" optional
The live name (default scatter).

Methods

public ScatterPlot Add(double x, double y, ThemeToken? role = null) #

Adds a point.

Parameters

x double required
The horizontal value.
y double required
The vertical value.
role ConsoleMonster.Styling.ThemeToken? = null optional
The colour role, or null for ScatterPlot.Role.

Returns

ScatterPlot This instance.
public override void Apply(LiveEvent liveEvent) #

Applies an event to the widget's state.

Parameters

liveEvent ConsoleMonster.Live.LiveEvent required
The event.
public ScatterPlot Clear() #

Removes every point.

Returns

ScatterPlot This instance.
public SparklineHandle Handle(ILiveDispatcher dispatcher) #

Returns a handle that adds values through a dispatcher.

Parameters

dispatcher ConsoleMonster.Live.ILiveDispatcher required
The dispatcher.

Returns

SparklineHandle The handle.
public override 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 override 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.

Properties

public IReadOnlyList<ScatterPoint> Points { get; } #

The points, oldest first.

public int Height { get; set; } #

Rows for the plot, its x axis and the axis labels (default 8).

public int Capacity { get; set; } #

How many points the plot keeps; the oldest are dropped past it (default 4096).

public ThemeToken Role { get; set; } #

The colour role of points without their own (default ThemeToken.Series1).

public double? Minimum { get; set; } #

A fixed minimum for the y axis, or null (0 when all values are positive).

public double? Maximum { get; set; } #

A fixed maximum for the y axis, or null for the largest value.

public string? Unit { get; set; } #

A unit appended to the y axis values (for example s).

public Func<double, string>? ValueFormat { get; set; } #
Fluent("ValueFormatBy")

Formats the y axis values (for example seconds as 1m 05s), or null for the compact number and ScatterPlot.Unit.

public string? StartLabel { get; set; } #

The literal label under the left end of the x axis (for example "first"), or null for none.

public string? EndLabel { get; set; } #

The literal label under the right end of the x axis (for example "now"), or null for none.

Extension Methods

public static ScatterPlot Capacity(ScatterPlot scatterPlot, int value) #

Sets ScatterPlot.Capacity: How many points the plot keeps; the oldest are dropped past it (default 4096).

Parameters

scatterPlot ConsoleMonster.Widgets.ScatterPlot required
The instance.
value int required
The value.

Returns

ScatterPlot The same instance.

Examples

// C# initializer or property                                           // C# fluent
new global::ConsoleMonster.Widgets.ScatterPlot { Capacity = value };    scatterPlot.Capacity(value);
public static ScatterPlot EndLabel(ScatterPlot scatterPlot, string? value) #

Sets ScatterPlot.EndLabel: The literal label under the right end of the x axis (for example "now"), or null for none.

Parameters

scatterPlot ConsoleMonster.Widgets.ScatterPlot required
The instance.
value string? required
The value.

Returns

ScatterPlot The same instance.

Examples

// C# initializer or property                                           // C# fluent
new global::ConsoleMonster.Widgets.ScatterPlot { EndLabel = value };    scatterPlot.EndLabel(value);
public static ScatterPlot Height(ScatterPlot scatterPlot, int value) #

Sets ScatterPlot.Height: Rows for the plot, its x axis and the axis labels (default 8).

Parameters

scatterPlot ConsoleMonster.Widgets.ScatterPlot required
The instance.
value int required
The value.

Returns

ScatterPlot The same instance.

Examples

// C# initializer or property                                         // C# fluent
new global::ConsoleMonster.Widgets.ScatterPlot { Height = value };    scatterPlot.Height(value);
public static ScatterPlot Maximum(ScatterPlot scatterPlot, double? value) #

Sets ScatterPlot.Maximum: A fixed maximum for the y axis, or null for the largest value.

Parameters

scatterPlot ConsoleMonster.Widgets.ScatterPlot required
The instance.
value double? required
The value.

Returns

ScatterPlot The same instance.

Examples

// C# initializer or property                                          // C# fluent
new global::ConsoleMonster.Widgets.ScatterPlot { Maximum = value };    scatterPlot.Maximum(value);
public static ScatterPlot Minimum(ScatterPlot scatterPlot, double? value) #

Sets ScatterPlot.Minimum: A fixed minimum for the y axis, or null (0 when all values are positive).

Parameters

scatterPlot ConsoleMonster.Widgets.ScatterPlot required
The instance.
value double? required
The value.

Returns

ScatterPlot The same instance.

Examples

// C# initializer or property                                          // C# fluent
new global::ConsoleMonster.Widgets.ScatterPlot { Minimum = value };    scatterPlot.Minimum(value);
public static ScatterPlot Role(ScatterPlot scatterPlot, ThemeToken value) #

Sets ScatterPlot.Role: The colour role of points without their own (default ThemeToken.Series1).

Parameters

scatterPlot ConsoleMonster.Widgets.ScatterPlot required
The instance.
value ConsoleMonster.Styling.ThemeToken required
The value.

Returns

ScatterPlot The same instance.

Examples

// C# initializer or property                                       // C# fluent
new global::ConsoleMonster.Widgets.ScatterPlot { Role = value };    scatterPlot.Role(value);
public static ScatterPlot StartLabel(ScatterPlot scatterPlot, string? value) #

Sets ScatterPlot.StartLabel: The literal label under the left end of the x axis (for example "first"), or null for none.

Parameters

scatterPlot ConsoleMonster.Widgets.ScatterPlot required
The instance.
value string? required
The value.

Returns

ScatterPlot The same instance.

Examples

// C# initializer or property                                             // C# fluent
new global::ConsoleMonster.Widgets.ScatterPlot { StartLabel = value };    scatterPlot.StartLabel(value);
public static ScatterPlot Unit(ScatterPlot scatterPlot, string? value) #

Sets ScatterPlot.Unit: A unit appended to the y axis values (for example s).

Parameters

scatterPlot ConsoleMonster.Widgets.ScatterPlot required
The instance.
value string? required
The value.

Returns

ScatterPlot The same instance.

Examples

// C# initializer or property                                       // C# fluent
new global::ConsoleMonster.Widgets.ScatterPlot { Unit = value };    scatterPlot.Unit(value);
public static ScatterPlot ValueFormatBy(ScatterPlot scatterPlot, Func<double, string>? value) #

Sets ScatterPlot.ValueFormat: Formats the y axis values (for example seconds as 1m 05s), or null for the compact number and ScatterPlot.Unit.

Parameters

scatterPlot ConsoleMonster.Widgets.ScatterPlot required
The instance.
value System.Func<double, string>? required
The callback.

Returns

ScatterPlot The same instance.

Examples

// C# initializer or property                                              // C# fluent
new global::ConsoleMonster.Widgets.ScatterPlot { ValueFormat = value };    scatterPlot.ValueFormatBy(value);