Sparkline class
Namespace: Arlecchino.Widgets.Readouts · Assembly: Arlecchino
A series of numbers as one row of blocks, tallest for the largest of them, with no axis, scale or grid. The newest value is the rightmost, and only as many as fit the row are drawn.
public sealed class Sparkline : IArlecchinoWidget
Implements IArlecchinoWidget
Constructors
| Member | Summary |
|---|---|
Sparkline() |
Properties
| Member | Summary |
|---|---|
Caption | Builds the readout drawn after the line, given the newest value. Supplied as a delegate so the wording and units stay with the application rather than the widget. |
Maximum | The value the tallest block stands for. The largest of the drawn values when left alone. |
Minimum | The value the lowest block stands for, which is the smallest of the drawn values when left alone. Pinning it keeps the line still where the numbers barely change. |
Style | Color of the line. The theme's active color when left alone. |
Values | The numbers to draw, the oldest first. Nothing is copied, so a ring buffer the application appends to between frames is the right thing to hand over. |
Methods
| Member | Summary |
|---|---|
Draw(SurfaceRegion) | Draws the line across the first row of the region, leaving room for the caption when there is one. A series with no spread at all draws as the lowest block rather than as a full row. |
Constructors in detail
Sparkline()
public Sparkline();
Properties in detail
Caption
public Func<decimal, string>? Caption { get; init; }
Builds the readout drawn after the line, given the newest value. Supplied as a delegate so the wording and units stay with the application rather than the widget.
Type Func<T, TResult><decimal, string>
Maximum
public Nullable<decimal> Maximum { get; init; }
The value the tallest block stands for. The largest of the drawn values when left alone.
Type Nullable<T><decimal>
Minimum
public Nullable<decimal> Minimum { get; init; }
The value the lowest block stands for, which is the smallest of the drawn values when left alone. Pinning it keeps the line still where the numbers barely change.
Type Nullable<T><decimal>
Style
public IArlecchinoColor? Style { get; init; }
Color of the line. The theme's active color when left alone.
Type IArlecchinoColor
Values
public IReadOnlyList<decimal> Values { get; set; }
The numbers to draw, the oldest first. Nothing is copied, so a ring buffer the application appends to between frames is the right thing to hand over.
Type IReadOnlyList<T><decimal>
Methods in detail
Draw(SurfaceRegion)
public SurfaceRegion Draw(SurfaceRegion region);
Draws the line across the first row of the region, leaving room for the caption when there is one. A series with no spread at all draws as the lowest block rather than as a full row.
Parameters
| Name | Type | Description |
|---|---|---|
region | SurfaceRegion | Where to draw; only its first row is used. |
Returns SurfaceRegion — The region below the line.