BreakdownChart

Display

Displays 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
NameTypeDefaultDescription
Appearance
ValueColorNullable<Color>Color in which the values will be shown. If null , uses default color.
WidthNullable<Int32>Width of the breakdown chart in characters. If null , automatically calculated.
Common
ShowTagValuesBooleanWhether to show tag values. Default is false .
ShowTagValuesPercentageBooleanWhether to show tag values with percentage. Default is false .
Other
BreakdownChartItemsList<IBreakdownChartItem>Renders a breakdown chart using Spectre.Console's BreakdownChart renderable.
CompactBooleanWhether the chart and tags should be rendered in compact mode. Default is false .
CultureCultureInfoCultureInfo to use when rendering values. Default is CurrentCulture.
ExpandBooleanWhether the chart should expand to available space. When false , width is automatically calculated. Default is false .
ShowTagsBooleanWhether to show tags. Default is false .

API