BreakdownChart
DisplayDisplays a breakdown chart showing proportional data.
@using RazorConsole.Components
@using System.Globalization
@using Spectre.Console
<RazorConsole.Components.BreakdownChart BreakdownChartItems="@Expenses"
Compact="true"
ShowTags="true"
ShowTagValues="true"
ShowTagValuesPercentage="true"
Culture="@CultureInfo.InvariantCulture" />
@code {
private List<IBreakdownChartItem> Expenses => new()
{
new BreakdownChartItem("Food", 3200, Color.FromHex("F5F543")),
new BreakdownChartItem("Transport", 1800, Color.FromHex("3B8EEA")),
new BreakdownChartItem("Utilities", 2500, Color.FromHex("CD3131")),
new BreakdownChartItem("Fun", 1400, Color.FromHex("0DBC79")),
new BreakdownChartItem("Other", 1100, Color.FromHex("666666"))
};
}Parameters
9| Name | Type | Default | Description |
|---|---|---|---|
Appearance | |||
ValueColor | Nullable<Color> | — | Color in which the values will be shown. If null , uses default color. |
Width | Nullable<Int32> | — | Width of the breakdown chart in characters. If null , automatically calculated. |
Common | |||
ShowTagValues | Boolean | — | Whether to show tag values. Default is false . |
ShowTagValuesPercentage | Boolean | — | Whether to show tag values with percentage. Default is false . |
Other | |||
BreakdownChartItems | List<IBreakdownChartItem> | — | Renders a breakdown chart using Spectre.Console's BreakdownChart renderable. |
Compact | Boolean | — | Whether the chart and tags should be rendered in compact mode. Default is false . |
Culture | CultureInfo | — | CultureInfo to use when rendering values. Default is CurrentCulture. |
Expand | Boolean | — | Whether the chart should expand to available space. When false , width is automatically calculated. Default is false . |
ShowTags | Boolean | — | Whether to show tags. Default is false . |