Table of Contents

Class TwValueChartBase

Namespace
TwBlazor.Components
Assembly
TwBlazor.dll

The base class for charts that plot a single list of labelled values, such as a pie or a funnel. It supplies the table view, leaving the marks to the chart type.

public abstract class TwValueChartBase : TwChartBase, IComponent, IHandleEvent, IHandleAfterRender, ITwComponent, IAsyncDisposable
Inheritance
TwValueChartBase
Implements
Derived
Inherited Members

Constructors

TwValueChartBase()

protected TwValueChartBase()

Properties

Data

Gets or sets the values to plot.

[Parameter]
public IReadOnlyList<ChartValue> Data { get; set; }

Property Value

IReadOnlyList<ChartValue>

LabelHeader

Gets or sets the heading of the label column in the table view. Defaults to the localized Chart_Category text ("Category").

[Parameter]
public string? LabelHeader { get; set; }

Property Value

string

OtherLabel

Gets or sets the label of the slice that collects the smallest values once there are more values than colors. Defaults to the localized Chart_Other text ("Other").

[Parameter]
public string? OtherLabel { get; set; }

Property Value

string

ValueHeader

Gets or sets the heading of the value column in the table view. It also labels the value in tooltips. Defaults to the localized Chart_Value text ("Value").

[Parameter]
public string? ValueHeader { get; set; }

Property Value

string

effectiveValueHeader

protected string effectiveValueHeader { get; }

Property Value

string

Methods

BuildMarks(ChartSceneBuilder)

Adds the marks, data points and axes for the values.

protected abstract void BuildMarks(ChartSceneBuilder builder)

Parameters

builder ChartSceneBuilder

The builder that collects the scene.

BuildScene(ChartSceneBuilder)

Describes what the chart draws by adding marks, data points, axes, legend entries and a table to builder. Add nothing to show the empty state.

protected override sealed void BuildScene(ChartSceneBuilder builder)

Parameters

builder ChartSceneBuilder

The builder that collects the scene.

FormatShare(double, double)

Formats a share of a whole as a percentage.

protected static string FormatShare(double value, double total)

Parameters

value double

The part.

total double

The whole.

Returns

string

GetFoldedData(int)

Gets the positive values, with the smallest folded into one OtherLabel entry when there are more than limit. Charts that color each value use this so a color is never reused.

protected IReadOnlyList<ChartValue> GetFoldedData(int limit = 8)

Parameters

limit int

The most entries to return.

Returns

IReadOnlyList<ChartValue>