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
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
Series
Gets or sets the series to plot. Each holds one value per category.
[Parameter]
public IReadOnlyList<ChartSeries> Series { get; set; }
Property Value
effectiveCategoryHeader
protected string effectiveCategoryHeader { get; }
Property Value
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
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
builderChartSceneBuilderThe builder that collects the scene.
seriesIReadOnlyList<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
builderChartSceneBuilderThe 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
seriesIReadOnlyList<ChartSeriesSlot>The visible series.
categoryintThe zero-based category index.
Returns
GetValues(IReadOnlyList<ChartSeriesSlot>)
Gets every value the visible series hold, skipping missing ones.
protected IEnumerable<double> GetValues(IReadOnlyList<ChartSeriesSlot> series)
Parameters
seriesIReadOnlyList<ChartSeriesSlot>The visible series.