API Reference
BarChart
Horizontal bars with labels and values, sub-cell precise per glyph tier. All bars share one colour unless an item sets its own token or a value crosses BarChart.Warning or BarChart.Critical, so the chart does not shout. Live operations (Key = label): set (Value), add (Value).
Inheritance
- LiveWidget
- BarChart
Usage
Explore 34 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.
Returned or exposed by 18
- Method ConsoleView.BuildChart
- Extension method BarChart.WithBarToken
- Extension method BarChart.WithCritical
- Extension method BarChart.WithMax
- Extension method BarChart.WithShape
- Extension method BarChart.WithShowValues
- Extension method BarChart.WithUnit
- Extension method BarChart.WithValueColumn
- Extension method BarChart.WithWarning
- Method BarChart.Add
- Method BarChartFluent.WithBarToken
- Method BarChartFluent.WithCritical
- Method BarChartFluent.WithMax
- Method BarChartFluent.WithShape
- Method BarChartFluent.WithShowValues
- Method BarChartFluent.WithUnit
- Method BarChartFluent.WithValueColumn
- Method BarChartFluent.WithWarning
Accepted by parameters 16
- Extension method BarChart.WithBarToken
- Extension method BarChart.WithCritical
- Extension method BarChart.WithMax
- Extension method BarChart.WithShape
- Extension method BarChart.WithShowValues
- Extension method BarChart.WithUnit
- Extension method BarChart.WithValueColumn
- Extension method BarChart.WithWarning
- Method BarChartFluent.WithBarToken
- Method BarChartFluent.WithCritical
- Method BarChartFluent.WithMax
- Method BarChartFluent.WithShape
- Method BarChartFluent.WithShowValues
- Method BarChartFluent.WithUnit
- Method BarChartFluent.WithValueColumn
- Method BarChartFluent.WithWarning
Constructors
public BarChart(String name = "bars") #Creates a bar chart.
Parameters
- name System.String = "bars"
- The live name (default bars).
Methods
public BarChart Add(RichText label, Double value, ThemeToken? token = null) #BarChartAdds or updates an item with a multicolour label (its plain text is the key).
Parameters
- label ConsoleMonster.Text.RichText
- The rich label.
- value System.Double
- The value.
- token ConsoleMonster.Styling.ThemeToken? = null
- An optional colour token.
Returns
This instance.
public BarChart Add(String label, Double value, ThemeToken? token = null) #BarChartAdds or updates an item.
Parameters
- label System.String
- The label.
- value System.Double
- The value.
- token ConsoleMonster.Styling.ThemeToken? = null
- An optional colour token.
Returns
This instance.
public override Void Apply(LiveEvent liveEvent) #VoidApplies an event to the widget's state.
Parameters
- liveEvent ConsoleMonster.Live.LiveEvent
- The event.
public override Size Measure(Constraints constraints, RenderContext context) #SizeReturns the size the widget wants within the constraints.
Parameters
- constraints ConsoleMonster.Layout.Constraints
- The space offered.
- context ConsoleMonster.Canvas.RenderContext
- Profile, theme and glyphs.
Returns
The desired size, never larger than the constraints.
public override Void Render(Region region, RenderContext context) #VoidRenders into a region. The region may be smaller or larger than the measured size.
Parameters
- region ConsoleMonster.Canvas.Region
- The target region.
- context ConsoleMonster.Canvas.RenderContext
- Profile, theme and glyphs.
public StatusKind? Threshold(Double value) #StatusKind?The status a value reaches against BarChart.Warning and BarChart.Critical, or null below both.
Parameters
- value System.Double
- The value.
Returns
Fail, Warn or null.
Inherited Methods
public virtual String? Describe(LiveEvent liveEvent) #String?Parameters
- liveEvent LiveEvent
public virtual Boolean Equals(Object? obj) #BooleanParameters
- obj Object?
Properties
public Double? Max { get; set; } #The value of a full bar, or null for the largest item.
public ThemeToken BarToken { get; set; } #The default bar colour (default ThemeToken.Series1).
public Boolean ShowValues { get; set; } #Whether values are shown after the bars (default true).
public BarShape Shape { get; set; } #The bar shape: BarShape.Block (default, solid three-quarter-height bars that keep a gap between rows) or BarShape.Line.
public ColumnFormat ValueColumn { get; set; } #Layout of the value column on the right (default right-aligned). Its width never shrinks during a session, so the bars keep their scale when a value grows from 9 to 10.
public Double? Warning { get; set; } #The value from which a bar is a warning (warning colour), or null. With BarChart.Critical below it, lower values are worse (free space); otherwise higher values are (disk use). An item's own colour wins.
public Double? Critical { get; set; } #The value from which a bar is critical (fail colour), or null. See BarChart.Warning.
Inherited Properties
Extension Methods
public static BarChart WithBarToken(BarChart barChart, ThemeToken value) #BarChartSets BarChart.BarToken: The default bar colour (default ThemeToken.Series1).
Parameters
- barChart ConsoleMonster.Widgets.BarChart
- The instance.
- value ConsoleMonster.Styling.ThemeToken
- The value.
Returns
The same instance.
public static BarChart WithCritical(BarChart barChart, Double? value) #BarChartSets BarChart.Critical: The value from which a bar is critical (fail colour), or null. See BarChart.Warning.
Parameters
- barChart ConsoleMonster.Widgets.BarChart
- The instance.
- value System.Double?
- The value.
Returns
The same instance.
public static BarChart WithMax(BarChart barChart, Double? value) #BarChartSets BarChart.Max: The value of a full bar, or null for the largest item.
Parameters
- barChart ConsoleMonster.Widgets.BarChart
- The instance.
- value System.Double?
- The value.
Returns
The same instance.
public static BarChart WithShape(BarChart barChart, BarShape value) #BarChartSets BarChart.Shape: The bar shape: BarShape.Block (default, solid three-quarter-height bars that keep a gap between rows) or BarShape.Line.
Parameters
- barChart ConsoleMonster.Widgets.BarChart
- The instance.
- value ConsoleMonster.Widgets.BarShape
- The value.
Returns
The same instance.
public static BarChart WithShowValues(BarChart barChart, Boolean value = true) #BarChartSets BarChart.ShowValues: Whether values are shown after the bars (default true).
Parameters
- barChart ConsoleMonster.Widgets.BarChart
- The instance.
- value System.Boolean = true
- The value (default true).
Returns
The same instance.
public static BarChart WithUnit(BarChart barChart, String? value) #BarChartSets BarChart.Unit: A unit appended to values (for example ms).
Parameters
- barChart ConsoleMonster.Widgets.BarChart
- The instance.
- value System.String?
- The value.
Returns
The same instance.
public static BarChart WithValueColumn(BarChart barChart, ColumnFormat value) #BarChartSets BarChart.ValueColumn: Layout of the value column on the right (default right-aligned). Its width never shrinks during a session, so the bars keep their scale when a value grows from 9 to 10.
Parameters
- barChart ConsoleMonster.Widgets.BarChart
- The instance.
- value ConsoleMonster.Layout.ColumnFormat
- The value.
Returns
The same instance.
public static BarChart WithValueColumn(BarChart barChart, Action<ColumnFormat> configure) #BarChartConfigures BarChart.ValueColumn in place: Layout of the value column on the right (default right-aligned). Its width never shrinks during a session, so the bars keep their scale when a value grows from 9 to 10.
Parameters
- barChart ConsoleMonster.Widgets.BarChart
- The instance.
- configure System.Action<ConsoleMonster.Layout.ColumnFormat>
- Configures the value.
Returns
The same instance.
public static BarChart WithWarning(BarChart barChart, Double? value) #BarChartSets BarChart.Warning: The value from which a bar is a warning (warning colour), or null. With BarChart.Critical below it, lower values are worse (free space); otherwise higher values are (disk use). An item's own colour wins.
Parameters
- barChart ConsoleMonster.Widgets.BarChart
- The instance.
- value System.Double?
- The value.
Returns
The same instance.