BarChart Class
A renderable (horizontal) bar chart.
public sealed class BarChart : Renderable, IRenderable, IHasCulture
- Namespace
- Spectre
.Console - Interfaces
- Base Types
Constructors
-
BarChart
() -
Initializes a new instance of the
BarChart
class.
Properties
- CultureInfo Culture
- Gets or sets the culture that's used to format values.
- List<IBarChartItem> Data
- Gets the bar chart data.
- string Label
- Gets or sets the bar chart label.
- Justify? LabelAlignment
- Gets or sets the bar chart label alignment.
- double? MaxValue
- Gets or sets the fixed max value for a bar chart.
- bool ShowValues
- Gets or sets a value indicating whether or not values should be shown next to each bar.
- Func<double, CultureInfo, string> ValueFormatter
- Gets or sets the function used to format the values of the bar chart.
- int? Width
- Gets or sets the width of the bar chart.
Methods
-
protected override Measurement Measure
(RenderOptions, int) - Measures the renderable object.
-
protected override IEnumerable<Segment> Render
(RenderOptions, int) - Renders the object.
Extension Methods
-
BarChart AddItem
(string, double, Color?) - Adds an item to the bar chart.
-
BarChart AddItem
<T> (T) - Adds an item to the bar chart.
-
BarChart AddItems
<T> (IEnumerable <T> , Func <T, BarChartItem> ) - Adds multiple items to the bar chart.
-
BarChart AddItems
<T> (IEnumerable <T> ) - Adds multiple items to the bar chart.
-
BarChart CenterLabel
() - Centers the label.
-
T Culture
<BarChart> (CultureInfo) - Sets the culture.
-
T Culture
<BarChart> (int) - Sets the culture.
-
T Culture
<BarChart> (string) - Sets the culture.
-
IEnumerable<Segment> GetSegments
(IAnsiConsole) - Gets the segments for a renderable using the specified console.
-
BarChart HideValues
() - Hides values next to each bar in the bar chart.
-
BarChart Label
(string) - Sets the label of the bar chart.
-
BarChart LeftAlignLabel
() - Aligns the label to the left.
-
BarChart RightAlignLabel
() - Aligns the label to the right.
-
BarChart ShowValues
(bool) - Sets whether or not values should be shown next to each bar.
-
BarChart ShowValues
() - Shows values next to each bar in the bar chart.
-
BarChart UseValueFormatter
(Func <double, CultureInfo, string> ) - Sets the value formatter for the bar chart using culture info.
-
BarChart UseValueFormatter
(Func <double, string> ) - Sets the value formatter for the bar chart.
-
BarChart Width
(int?) - Sets the width of the bar chart.
-
BarChart WithMaxValue
(double) - Sets the max fixed value for the chart.