Skip to main content

Gauge class

Namespace: Arlecchino.Widgets.Readouts · Assembly: Arlecchino

One value against a range, drawn as a bar whose color changes as it crosses the bands it was given. Each part of the fill keeps the color of its own band.

public sealed class Gauge : IArlecchinoWidget

Implements IArlecchinoWidget

Constructors

MemberSummary
Gauge()

Properties

MemberSummary
BandsThe bands the track is colored by, in ascending order of GaugeBand.From. Without them the whole fill takes Gauge.Style, which makes the gauge a bar with a range.
CaptionBuilds the text drawn after the gauge, given the value.
FractionHow full the gauge is, from 0 to 1. An empty range reads as 0.
MaximumValue at which the gauge reads full.
MinimumValue at which the gauge reads empty.
StyleColor of the fill outside every band. The theme's active color when left alone.
ValueWhat it reads now. Anything outside the range draws as an empty or a full gauge.

Methods

MemberSummary
Draw(SurfaceRegion)Draws the gauge across the first row of the region, leaving room for the caption when there is one, and returns the rows below it.
StyleAt(decimal)How a value of the range is drawn: the style of the last band at or below it, and Gauge.Style when it is under every band. Useful for coloring a label the same way the gauge under it is colored.

Constructors in detail

Gauge()

public Gauge();

Properties in detail

Bands

public IReadOnlyList<GaugeBand> Bands { get; init; }

The bands the track is colored by, in ascending order of GaugeBand.From. Without them the whole fill takes Gauge.Style, which makes the gauge a bar with a range.

Type IReadOnlyList<T><GaugeBand>

Caption

public Func<decimal, string>? Caption { get; init; }

Builds the text drawn after the gauge, given the value.

Type Func<T, TResult><decimal, string>

Fraction

public decimal Fraction { get; }

How full the gauge is, from 0 to 1. An empty range reads as 0.

Type decimal

Maximum

public decimal Maximum { get; init; }

Value at which the gauge reads full.

Type decimal

Minimum

public decimal Minimum { get; init; }

Value at which the gauge reads empty.

Type decimal

Style

public IArlecchinoColor? Style { get; init; }

Color of the fill outside every band. The theme's active color when left alone.

Type IArlecchinoColor

Value

public decimal Value { get; set; }

What it reads now. Anything outside the range draws as an empty or a full gauge.

Type decimal

Methods in detail

Draw(SurfaceRegion)

public SurfaceRegion Draw(SurfaceRegion region);

Draws the gauge across the first row of the region, leaving room for the caption when there is one, and returns the rows below it.

Parameters

NameTypeDescription
regionSurfaceRegionWhere to draw; only its first row is used.

Returns SurfaceRegion — The region below the gauge.

StyleAt(decimal)

public IArlecchinoColor StyleAt(decimal value);

How a value of the range is drawn: the style of the last band at or below it, and Gauge.Style when it is under every band. Useful for coloring a label the same way the gauge under it is colored.

Parameters

NameTypeDescription
valuedecimalThe value to look up.

Returns IArlecchinoColor — The style that part of the track takes.