BarChart
ConsoleMonster.Widgets
Horizontal bars with labels and values, sub-cell precise per glyph tier. All bars share one colour unless an item sets its own role 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 78 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 40
- Method Ui.BarChart
- Method ConsoleView.BuildChart
- Extension method BarChart.AxisLabel
- Extension method BarChart.BarHeader
- Extension method BarChart.BarWidth
- Extension method BarChart.Critical
- Extension method BarChart.LabelHeader
- Extension method BarChart.Maximum
- Extension method BarChart.MissingText
- Extension method BarChart.Role
- Extension method BarChart.Shape
- Extension method BarChart.ShowTrack
- Extension method BarChart.ShowValues
- Extension method BarChart.Signed
- Extension method BarChart.SpanMissingValues
- Extension method BarChart.Unit
- Extension method BarChart.ValueColumn
- Extension method BarChart.ValueHeader
- Extension method BarChart.ValuePresenter
- Extension method BarChart.Warning
- Method BarChart.Add
- Method BarChart.Missing
- Method BarChartFluent.AxisLabel
- Method BarChartFluent.BarHeader
- Method BarChartFluent.BarWidth
- Method BarChartFluent.Critical
- Method BarChartFluent.LabelHeader
- Method BarChartFluent.Maximum
- Method BarChartFluent.MissingText
- Method BarChartFluent.Role
- Method BarChartFluent.Shape
- Method BarChartFluent.ShowTrack
- Method BarChartFluent.ShowValues
- Method BarChartFluent.Signed
- Method BarChartFluent.SpanMissingValues
- Method BarChartFluent.Unit
- Method BarChartFluent.ValueColumn
- Method BarChartFluent.ValueHeader
- Method BarChartFluent.ValuePresenter
- Method BarChartFluent.Warning
Accepted by parameters 38
- Method ContentBuilder.BarChart
- Method ContentBuilder.BarChart
- Extension method BarChart.AxisLabel
- Extension method BarChart.BarHeader
- Extension method BarChart.BarWidth
- Extension method BarChart.Critical
- Extension method BarChart.LabelHeader
- Extension method BarChart.Maximum
- Extension method BarChart.MissingText
- Extension method BarChart.Role
- Extension method BarChart.Shape
- Extension method BarChart.ShowTrack
- Extension method BarChart.ShowValues
- Extension method BarChart.Signed
- Extension method BarChart.SpanMissingValues
- Extension method BarChart.Unit
- Extension method BarChart.ValueColumn
- Extension method BarChart.ValueHeader
- Extension method BarChart.ValuePresenter
- Extension method BarChart.Warning
- Method BarChartFluent.AxisLabel
- Method BarChartFluent.BarHeader
- Method BarChartFluent.BarWidth
- Method BarChartFluent.Critical
- Method BarChartFluent.LabelHeader
- Method BarChartFluent.Maximum
- Method BarChartFluent.MissingText
- Method BarChartFluent.Role
- Method BarChartFluent.Shape
- Method BarChartFluent.ShowTrack
- Method BarChartFluent.ShowValues
- Method BarChartFluent.Signed
- Method BarChartFluent.SpanMissingValues
- Method BarChartFluent.Unit
- Method BarChartFluent.ValueColumn
- Method BarChartFluent.ValueHeader
- Method BarChartFluent.ValuePresenter
- Method BarChartFluent.Warning
Constructors
public BarChart(string widgetId = "bars") #Creates a bar chart.
Parameters
- widgetId string = "bars"
- The live name (default bars).
Methods
public BarChart Add(RichText label, double value, ThemeToken? role = null, string? key = null) #Adds or updates an item with a multicolour label (its plain text is the key).
Parameters
- label ConsoleMonster.Text.RichText
- The rich label.
- value double
- The value.
- role ConsoleMonster.Styling.ThemeToken? = null
- An optional colour role.
- key string? = null
- Stable item identity, or null to use the label.
public BarChart Add(string label, double value, ThemeToken? role = null, string? key = null) #Adds or updates an item.
Parameters
- label string
- The label.
- value double
- The value.
- role ConsoleMonster.Styling.ThemeToken? = null
- An optional colour role.
- key string? = null
- Stable item identity, or null to use the label.
public override void Apply(LiveEvent liveEvent) #Applies an event to the widget's state.
Parameters
- liveEvent ConsoleMonster.Live.LiveEvent
- The event.
public override Size Measure(Constraints constraints, RenderContext context) #Returns the size the widget wants within the constraints.
Parameters
- constraints ConsoleMonster.Layout.Constraints
- The space offered.
- context ConsoleMonster.Canvas.RenderContext
- Profile, theme and glyphs.
public BarChart Missing(string label, string? text = null, StatusKind? status = null, string? key = null) #Adds an item without a measurement, preserving its status and explanatory text.
Parameters
- label string
- The plain text label.
- text string? = null
- The missing-measurement explanation, or null for the chart default.
- status ConsoleMonster.Styling.StatusKind? = null
- An optional status.
- key string? = null
- Stable identity, or null to use the label.
public override void Render(Region region, RenderContext context) #Renders 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) #The status a value reaches against BarChart.Warning and BarChart.Critical, or null below both.
Parameters
- value double
- The value.
Inherited Methods
public virtual string? Describe(LiveEvent liveEvent) #Parameters
- liveEvent LiveEvent
Returns
string?Properties
public double? Maximum { get; set; } #The value of a full bar, or null for the largest item. Non-finite maxima use the largest finite item; a negative maximum is treated as zero, so signed bars always include their zero baseline.
public ThemeToken Role { get; set; } #The default bar colour (default ThemeToken.Series1).
public bool ShowValues { get; set; } #Whether values are shown after the bars (default true).
public bool Signed { get; set; } #Draws negative values to the left of a shared zero baseline; default false preserves zero-based bars.
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 numeric width never shrinks during a session, so the bars keep their scale when a value grows from 9 to 10. Missing explanations use only the current frame's available space and do not reserve width after a measurement arrives.
public string? AxisLabel { get; set; } #A shared plain text label below the bars, for example elapsed time since an observation.
public string? MissingText { get; set; } #The plain text shown for non-finite values; null retains the tier-appropriate dash.
public bool SpanMissingValues { get; set; } #Let a missing measurement's explanation span the bar and value columns.
public bool ShowTrack { get; set; } #Draw the unused portion of each bar as a muted track.
public int? BarWidth { get; set; } #Optional maximum bar width in cells; null uses all available room.
public ICellPresenter? ValuePresenter { get; set; } #Optional presenter for measured values, such as compact durations.
public string? LabelHeader { get; set; } #Optional label-column heading; any heading enables a segmented table header.
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 AxisLabel(BarChart barChart, string? value) #Sets BarChart.AxisLabel: A shared plain text label below the bars, for example elapsed time since an observation.
Parameters
- barChart ConsoleMonster.Widgets.BarChart
- The instance.
- value string?
- The value.
Examples
// C# initializer or property // C# fluent
new global::ConsoleMonster.Widgets.BarChart { AxisLabel = value }; Ui.BarChart().AxisLabel(value);public static BarChart BarHeader(BarChart barChart, string? value) #Sets BarChart.BarHeader: Optional bar-column heading.
Parameters
- barChart ConsoleMonster.Widgets.BarChart
- The instance.
- value string?
- The value.
Examples
// C# initializer or property // C# fluent
new global::ConsoleMonster.Widgets.BarChart { BarHeader = value }; Ui.BarChart().BarHeader(value);public static BarChart BarWidth(BarChart barChart, int? value) #Sets BarChart.BarWidth: Optional maximum bar width in cells; null uses all available room.
Parameters
- barChart ConsoleMonster.Widgets.BarChart
- The instance.
- value int?
- The value.
Examples
// C# initializer or property // C# fluent
new global::ConsoleMonster.Widgets.BarChart { BarWidth = value }; Ui.BarChart().BarWidth(value);public static BarChart Critical(BarChart barChart, double? value) #Sets 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 double?
- The value.
Examples
// C# initializer or property // C# fluent
new global::ConsoleMonster.Widgets.BarChart { Critical = value }; Ui.BarChart().Critical(value);public static BarChart LabelHeader(BarChart barChart, string? value) #Sets BarChart.LabelHeader: Optional label-column heading; any heading enables a segmented table header.
Parameters
- barChart ConsoleMonster.Widgets.BarChart
- The instance.
- value string?
- The value.
Examples
// C# initializer or property // C# fluent
new global::ConsoleMonster.Widgets.BarChart { LabelHeader = value }; Ui.BarChart().LabelHeader(value);public static BarChart Maximum(BarChart barChart, double? value) #Sets BarChart.Maximum: The value of a full bar, or null for the largest item. Non-finite maxima use the largest finite item; a negative maximum is treated as zero, so signed bars always include their zero baseline.
Parameters
- barChart ConsoleMonster.Widgets.BarChart
- The instance.
- value double?
- The value.
Examples
// C# initializer or property // C# fluent
new global::ConsoleMonster.Widgets.BarChart { Maximum = value }; Ui.BarChart().Maximum(value);public static BarChart MissingText(BarChart barChart, string? value) #Sets BarChart.MissingText: The plain text shown for non-finite values; null retains the tier-appropriate dash.
Parameters
- barChart ConsoleMonster.Widgets.BarChart
- The instance.
- value string?
- The value.
Examples
// C# initializer or property // C# fluent
new global::ConsoleMonster.Widgets.BarChart { MissingText = value }; Ui.BarChart().MissingText(value);public static BarChart Role(BarChart barChart, ThemeToken value) #Sets BarChart.Role: The default bar colour (default ThemeToken.Series1).
Parameters
- barChart ConsoleMonster.Widgets.BarChart
- The instance.
- value ConsoleMonster.Styling.ThemeToken
- The value.
Examples
// C# initializer or property // C# fluent
new global::ConsoleMonster.Widgets.BarChart { Role = value }; Ui.BarChart().Role(value);public static BarChart Shape(BarChart barChart, BarShape value) #Sets 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.
Examples
// C# initializer or property // C# fluent
new global::ConsoleMonster.Widgets.BarChart { Shape = value }; Ui.BarChart().Shape(value);public static BarChart ShowTrack(BarChart barChart, bool value = true) #Sets BarChart.ShowTrack: Draw the unused portion of each bar as a muted track.
Parameters
- barChart ConsoleMonster.Widgets.BarChart
- The instance.
- value bool = true
- The value; true when omitted.
Examples
// C# initializer or property // C# fluent
new global::ConsoleMonster.Widgets.BarChart { ShowTrack = value }; Ui.BarChart().ShowTrack(value);public static BarChart ShowValues(BarChart barChart, bool value = true) #Sets BarChart.ShowValues: Whether values are shown after the bars (default true).
Parameters
- barChart ConsoleMonster.Widgets.BarChart
- The instance.
- value bool = true
- The value; true when omitted.
Examples
// C# initializer or property // C# fluent
new global::ConsoleMonster.Widgets.BarChart { ShowValues = value }; Ui.BarChart().ShowValues(value);public static BarChart Signed(BarChart barChart, bool value = true) #Sets BarChart.Signed: Draws negative values to the left of a shared zero baseline; default false preserves zero-based bars.
Parameters
- barChart ConsoleMonster.Widgets.BarChart
- The instance.
- value bool = true
- The value; true when omitted.
Examples
// C# initializer or property // C# fluent
new global::ConsoleMonster.Widgets.BarChart { Signed = value }; Ui.BarChart().Signed(value);public static BarChart SpanMissingValues(BarChart barChart, bool value = true) #Sets BarChart.SpanMissingValues: Let a missing measurement's explanation span the bar and value columns.
Parameters
- barChart ConsoleMonster.Widgets.BarChart
- The instance.
- value bool = true
- The value; true when omitted.
Examples
// C# initializer or property // C# fluent
new global::ConsoleMonster.Widgets.BarChart { SpanMissingValues = value }; Ui.BarChart().SpanMissingValues(value);public static BarChart Unit(BarChart barChart, string? value) #Sets BarChart.Unit: A unit appended to values (for example ms).
Parameters
- barChart ConsoleMonster.Widgets.BarChart
- The instance.
- value string?
- The value.
Examples
// C# initializer or property // C# fluent
new global::ConsoleMonster.Widgets.BarChart { Unit = value }; Ui.BarChart().Unit(value);public static BarChart ValueColumn(BarChart barChart, ColumnFormat value) #Sets BarChart.ValueColumn: Layout of the value column on the right (default right-aligned). Its numeric width never shrinks during a session, so the bars keep their scale when a value grows from 9 to 10. Missing explanations use only the current frame's available space and do not reserve width after a measurement arrives.
Parameters
- barChart ConsoleMonster.Widgets.BarChart
- The instance.
- value ConsoleMonster.Layout.ColumnFormat
- The value.
Examples
// C# initializer or property // C# fluent
new global::ConsoleMonster.Widgets.BarChart { ValueColumn = value }; Ui.BarChart().ValueColumn(value);public static BarChart ValueColumn(BarChart barChart, Action<ColumnFormat> configure) #Configures BarChart.ValueColumn in place: Layout of the value column on the right (default right-aligned). Its numeric width never shrinks during a session, so the bars keep their scale when a value grows from 9 to 10. Missing explanations use only the current frame's available space and do not reserve width after a measurement arrives.
Parameters
- barChart ConsoleMonster.Widgets.BarChart
- The instance.
- configure System.Action<ConsoleMonster.Layout.ColumnFormat>
- Configures the value.
public static BarChart ValueHeader(BarChart barChart, string? value) #Sets BarChart.ValueHeader: Optional value-column heading.
Parameters
- barChart ConsoleMonster.Widgets.BarChart
- The instance.
- value string?
- The value.
Examples
// C# initializer or property // C# fluent
new global::ConsoleMonster.Widgets.BarChart { ValueHeader = value }; Ui.BarChart().ValueHeader(value);public static BarChart ValuePresenter(BarChart barChart, ICellPresenter? value) #Sets BarChart.ValuePresenter: Optional presenter for measured values, such as compact durations.
Parameters
- barChart ConsoleMonster.Widgets.BarChart
- The instance.
- value ConsoleMonster.Presenters.ICellPresenter?
- The value.
Examples
// C# initializer or property // C# fluent
new global::ConsoleMonster.Widgets.BarChart { ValuePresenter = value }; Ui.BarChart().ValuePresenter(value);public static BarChart Warning(BarChart barChart, double? value) #Sets 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 double?
- The value.
Examples
// C# initializer or property // C# fluent
new global::ConsoleMonster.Widgets.BarChart { Warning = value }; Ui.BarChart().Warning(value);