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
| Member | Summary |
|---|---|
Gauge() |
Properties
| Member | Summary |
|---|---|
Bands | 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. |
Caption | Builds the text drawn after the gauge, given the value. |
Fraction | How full the gauge is, from 0 to 1. An empty range reads as 0. |
Maximum | Value at which the gauge reads full. |
Minimum | Value at which the gauge reads empty. |
Style | Color of the fill outside every band. The theme's active color when left alone. |
Value | What it reads now. Anything outside the range draws as an empty or a full gauge. |
Methods
| Member | Summary |
|---|---|
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
| Name | Type | Description |
|---|---|---|
region | SurfaceRegion | Where 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
| Name | Type | Description |
|---|---|---|
value | decimal | The value to look up. |
Returns IArlecchinoColor — The style that part of the track takes.