Skip to content
ConsoleMonster

API Reference

Class

LineChart

Namespace ConsoleMonster.Widgets
Assembly ConsoleMonster
Implements
Modifiers sealed

A line or scatter chart on a sub-cell canvas: braille (2x4 dots per cell) on Full, half blocks on Basic and characters on Ascii. A y axis with min/max labels sits on the left, a legend below when there are several series. Live operation: add (Key = series, Value).

Inheritance

Usage

Explore 25 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 12

Constructors

public LineChart(String name = "chart") #

Creates a chart.

Parameters

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

Methods

public LineChart Add(String series, Double value) #
Returns: LineChart

Appends a value to a series (created when missing).

Parameters

series System.String requiredposition: 0
The series name.
value System.Double requiredposition: 1
The value.

Returns

This instance.

AddSeries 2 overloads
public ChartSeries AddSeries(RichText name, ThemeToken? token = null) #
Returns: ChartSeries

Adds a series with a multicolour legend name (its plain text is the key), or returns the existing one.

Parameters

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

Returns

The series.

public ChartSeries AddSeries(String name, ThemeToken? token = null) #
Returns: ChartSeries

Adds a series, or returns the existing one with that name.

Parameters

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

Returns

The series.

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 SparklineHandle Handle(ILiveDispatcher dispatcher) #
Returns: SparklineHandle

Returns a handle that appends values through a dispatcher.

Parameters

dispatcher ConsoleMonster.Live.ILiveDispatcher requiredposition: 0
The dispatcher.

Returns

The handle.

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<ChartSeries> Series { get; } #

The series.

public Int32 Height { get; set; } #

Rows for the plot including the x axis (default 8).

public Boolean Scatter { get; set; } #

Whether points are joined by lines (default) or drawn as a scatter.

public Int32 Capacity { get; set; } #

How many values each series keeps (default 512).

public Double? Min { get; set; } #

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

public Double? Max { get; set; } #

A fixed maximum for the y axis, or null.

public String? Unit { get; set; } #

A unit appended to axis labels.

Extension Methods

public static LineChart WithCapacity(LineChart lineChart, Int32 value) #
Returns: LineChart

Sets LineChart.Capacity: How many values each series keeps (default 512).

Parameters

lineChart ConsoleMonster.Widgets.LineChart requiredposition: 0
The instance.
value System.Int32 requiredposition: 1
The value.

Returns

The same instance.

public static LineChart WithHeight(LineChart lineChart, Int32 value) #
Returns: LineChart

Sets LineChart.Height: Rows for the plot including the x axis (default 8).

Parameters

lineChart ConsoleMonster.Widgets.LineChart requiredposition: 0
The instance.
value System.Int32 requiredposition: 1
The value.

Returns

The same instance.

public static LineChart WithMax(LineChart lineChart, Double? value) #
Returns: LineChart

Sets LineChart.Max: A fixed maximum for the y axis, or null.

Parameters

lineChart ConsoleMonster.Widgets.LineChart requiredposition: 0
The instance.
value System.Double? requiredposition: 1
The value.

Returns

The same instance.

public static LineChart WithMin(LineChart lineChart, Double? value) #
Returns: LineChart

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

Parameters

lineChart ConsoleMonster.Widgets.LineChart requiredposition: 0
The instance.
value System.Double? requiredposition: 1
The value.

Returns

The same instance.

public static LineChart WithScatter(LineChart lineChart, Boolean value = true) #
Returns: LineChart

Sets LineChart.Scatter: Whether points are joined by lines (default) or drawn as a scatter.

Parameters

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

Returns

The same instance.

public static LineChart WithUnit(LineChart lineChart, String? value) #
Returns: LineChart

Sets LineChart.Unit: A unit appended to axis labels.

Parameters

lineChart ConsoleMonster.Widgets.LineChart requiredposition: 0
The instance.
value System.String? requiredposition: 1
The value.

Returns

The same instance.