Skip to content

BreakdownChartWidget<T>

Namespace: Hex1b.Widgets

Assembly: Hex1b.dll

A widget that displays a proportional segmented bar.

csharp
public sealed record BreakdownChartWidget<T> : Hex1bWidget, IEquatable<Hex1bWidget>, IEquatable<BreakdownChartWidget<T>>

Inheritance

ObjectHex1bWidgetBreakdownChartWidget<T>

Implements

Properties

Data

Gets the data source for the chart.

Returns: IReadOnlyList<<T>>

csharp
public IReadOnlyList<T>? Data { get; init; }

Methods

Label(Func<T, string>)

Sets the function that extracts a segment label from each data item.

Parameters:

Returns: BreakdownChartWidget`1

csharp
public BreakdownChartWidget<T> Label(Func<T, string> selector)

Title(string)

Sets the chart title displayed above the bar.

Parameters:

Returns: BreakdownChartWidget`1

csharp
public BreakdownChartWidget<T> Title(string title)

Value(Func<T, double>)

Sets the function that extracts the numeric value from each data item.

Parameters:

Returns: BreakdownChartWidget`1

csharp
public BreakdownChartWidget<T> Value(Func<T, double> selector)

Remarks

BreakdownChartWidget always shows proportional data (100% of the total). Each segment's width is proportional to its value relative to the sum of all values.

Unlike and , this widget only supports a single series — no grouped or stacked modes.

Use to display a legend alongside this chart.

Examples

csharp
ctx.BreakdownChart([new("Data", 42), new("Packages", 18), new("Temp", 9)])
    .Title("Disk Usage")
ctx.Legend([new("Data", 42), new("Packages", 18), new("Temp", 9)])
    .ShowPercentages()

Released under the MIT License.