Table of Contents

Class TwCategoryChartBase

Namespace
TwBlazor.Components
Assembly
TwBlazor.dll

The base class for charts that plot one or more ChartSeries across a shared list of categories. It supplies the legend, the series toggling and the table view, leaving only the marks to the chart type.

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

Constructors

TwCategoryChartBase()

protected TwCategoryChartBase()

Properties

Categories

Gets or sets the category labels, in order.

[Parameter]
public IReadOnlyList<string> Categories { get; set; }

Property Value

IReadOnlyList<string>

CategoryHeader

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

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

Property Value

string

Series

Gets or sets the series to plot. Each holds one value per category.

[Parameter]
public IReadOnlyList<ChartSeries> Series { get; set; }

Property Value

IReadOnlyList<ChartSeries>

effectiveCategoryHeader

protected string effectiveCategoryHeader { get; }

Property Value

string

hasSeriesLegend

Gets whether each series gets a legend entry that can hide it. Charts that label their series directly on the plot turn this off.

protected virtual bool hasSeriesLegend { get; }

Property Value

bool

Methods

BuildMarks(ChartSceneBuilder, IReadOnlyList<ChartSeriesSlot>)

Adds the marks, data points and axes for the visible series.

protected abstract void BuildMarks(ChartSceneBuilder builder, IReadOnlyList<ChartSeriesSlot> series)

Parameters

builder ChartSceneBuilder

The builder that collects the scene.

series IReadOnlyList<ChartSeriesSlot>

The series the reader has not hidden. Never empty.

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.

GetRows(IReadOnlyList<ChartSeriesSlot>, int)

Builds the tooltip rows for one category: every visible series that has a value there.

protected IReadOnlyList<ChartDatumRow> GetRows(IReadOnlyList<ChartSeriesSlot> series, int category)

Parameters

series IReadOnlyList<ChartSeriesSlot>

The visible series.

category int

The zero-based category index.

Returns

IReadOnlyList<ChartDatumRow>

GetValues(IReadOnlyList<ChartSeriesSlot>)

Gets every value the visible series hold, skipping missing ones.

protected IEnumerable<double> GetValues(IReadOnlyList<ChartSeriesSlot> series)

Parameters

series IReadOnlyList<ChartSeriesSlot>

The visible series.

Returns

IEnumerable<double>