BarChart<T> class
Namespace: Arlecchino.Widgets.Readouts · Assembly: Arlecchino
One bar per item, laid out down the region: the label in front, the bar across the middle, the readout behind. Bars are measured against the largest item unless told otherwise.
public sealed class BarChart<T> : IArlecchinoWidget
Implements IArlecchinoWidget
Constructors
| Member | Summary |
|---|---|
BarChart() |
Properties
| Member | Summary |
|---|---|
Caption | Builds the readout drawn after each bar, given that bar's value. The readouts share one column, as wide as the longest of them, so the numbers line up under one another. |
ItemStyle | Colors one bar, for charts where a row means something — over budget, offline, picked. |
Items | What to chart, one bar per row. Replacing it between frames is a normal thing to do. |
LabelWidth | Columns kept for the labels. The widest label when left alone, up to a third of the region so a long name cannot squeeze the bars out of the pane. |
Maximum | The value at which a bar is full. The largest of the items when left alone; pin it to compare one frame against the next, or to keep a percentage chart honest when nothing has reached 100 yet. |
Render | Turns an item into the label in front of its bar. Longer labels are truncated by column. |
Value | The number the length of the bar stands for. Anything below zero draws as an empty bar. |
Methods
| Member | Summary |
|---|---|
Draw(SurfaceRegion) | Draws a bar for every item that fits and returns the rows below them. Items past the bottom of the region are not drawn, since the chart does not scroll. |
Constructors in detail
BarChart()
Constructors of types with required members are not supported in this version of your compiler.
public BarChart();
Properties in detail
Caption
public Func<decimal, string> Caption { get; init; }
Builds the readout drawn after each bar, given that bar's value. The readouts share one column, as wide as the longest of them, so the numbers line up under one another.
Type Func<T, TResult><decimal, string>
ItemStyle
public Func<T, IArlecchinoColor> ItemStyle { get; set; }
Colors one bar, for charts where a row means something — over budget, offline, picked.
Type Func<T, TResult><T, IArlecchinoColor>
Items
public IReadOnlyList<T> Items { get; set; }
What to chart, one bar per row. Replacing it between frames is a normal thing to do.
Type IReadOnlyList<T><T>
LabelWidth
public int LabelWidth { get; init; }
Columns kept for the labels. The widest label when left alone, up to a third of the region so a long name cannot squeeze the bars out of the pane.
Type int
Maximum
public Nullable<decimal> Maximum { get; init; }
The value at which a bar is full. The largest of the items when left alone; pin it to compare one frame against the next, or to keep a percentage chart honest when nothing has reached 100 yet.
Type Nullable<T><decimal>
Render
public Func<T, string> Render { get; init; }
Turns an item into the label in front of its bar. Longer labels are truncated by column.
Type Func<T, TResult><T, string>
Value
public Func<T, decimal> Value { get; init; }
The number the length of the bar stands for. Anything below zero draws as an empty bar.
Type Func<T, TResult><T, decimal>
Methods in detail
Draw(SurfaceRegion)
public SurfaceRegion Draw(SurfaceRegion region);
Draws a bar for every item that fits and returns the rows below them. Items past the bottom of the region are not drawn, since the chart does not scroll.
Parameters
| Name | Type | Description |
|---|---|---|
region | SurfaceRegion | Where to draw. |
Returns SurfaceRegion — The region below the bars.