Class BOBLineChart<TX, TY>
- Namespace
- BlazOrbit.Charts.Components
- Assembly
- BlazOrbit.Charts.dll
Continuous line chart with multi-series support. Auto-detects the X axis
type from TX:
- Numeric (int, double, decimal, …) → linear scale.
- System.DateTime, System.DateTimeOffset,
System.TimeSpan → temporal linear scale (projected via
Ticks; format string controls the tick label rendering). - Anything else → falls back to a categorical scale, equally spaced by category index in declaration order.
public class BOBLineChart<TX, TY> : BOBChartBase<TX, TY>, IDataVisualizationFamilyComponent, IHasSeries<TX, TY>, IHasAxes where TX : notnull
Type Parameters
TXX-axis domain type.
TYNumeric Y-axis domain type.
- Inheritance
-
objectComponentBaseBOBChartBase<TX, TY>BOBLineChart<TX, TY>
- Implements
-
IHasSeries<TX, TY>
- Derived
-
BOBAreaChart<TX, TY>
- Inherited Members
Constructors
BOBLineChart()
public BOBLineChart()
Properties
Annotations
Free-form annotations rendered on top of the series: text labels (BOBChartTextAnnotation<TX, TY>), vertical bands (BOBChartBandAnnotation<TX>), and symbol markers (BOBChartShapeAnnotation<TX, TY>).
[Parameter]
public IEnumerable<BOBChartAnnotation>? Annotations { get; set; }
Property Value
- IEnumerable<BOBChartAnnotation>
BrushAutoZoom
When true (default), a finished brush drag automatically
zooms to the selected X range. Disable to use brush purely as a
"select range" callback for master/detail layouts.
[Parameter]
public bool BrushAutoZoom { get; set; }
Property Value
- bool
BrushEnabled
When true, drag on the plot area paints a translucent
rectangle and on release fires OnBrush with the
selected X range. Brush takes priority over pan when both
ZoomEnabled and BrushEnabled are on:
drag = brush; wheel zoom + double-click reset still work.
Default false. Continuous X axes only.
[Parameter]
public bool BrushEnabled { get; set; }
Property Value
- bool
MarkerRadius
Pixel radius of the per-point markers when ShowMarkers is on.
[Parameter]
public double MarkerRadius { get; set; }
Property Value
- double
OnBrush
Fired when the user releases a brush drag. Carries the selected
range in the original TX domain.
[Parameter]
public EventCallback<BOBChartBrushArgs<TX>> OnBrush { get; set; }
Property Value
- EventCallback<BOBChartBrushArgs<TX>>
OnDataHover
Fired when the user hovers a point marker (mouseenter). Requires
ShowMarkers = true.
[Parameter]
public EventCallback<BOBChartHoverArgs<TX, TY>> OnDataHover { get; set; }
Property Value
- EventCallback<BOBChartHoverArgs<TX, TY>>
OnPointClick
Fired when the user clicks a point marker. Requires
ShowMarkers = true - when markers are off the
line itself has no per-point hit targets.
[Parameter]
public EventCallback<BOBChartClickArgs<TX, TY>> OnPointClick { get; set; }
Property Value
- EventCallback<BOBChartClickArgs<TX, TY>>
OnStreamUpdate
Fired after every streaming buffer mutation (append / reset / window-trim). Carries per-series counters for status banners.
[Parameter]
public EventCallback<BOBChartStreamArgs<TX, TY>> OnStreamUpdate { get; set; }
Property Value
- EventCallback<BOBChartStreamArgs<TX, TY>>
ReferenceLines
Horizontal reference / threshold lines drawn across the plot area (e.g. SLO targets, baselines, regulatory caps). Inherited by BOBAreaChart<TX, TY> automatically.
[Parameter]
public IEnumerable<BOBChartReferenceLine>? ReferenceLines { get; set; }
Property Value
- IEnumerable<BOBChartReferenceLine>
Series
The series rendered by the chart, in declaration order. Order affects stacking, legend listing and z-index.
[Parameter]
public IEnumerable<BOBChartSeries<TX, TY>>? Series { get; set; }
Property Value
- IEnumerable<BOBChartSeries<TX, TY>>
ShowCrosshair
When true, a vertical guide line tracks the mouse X across
the plot area on hover. The nearest data point per series is
highlighted simultaneously and an HTML readout pinned to the line
shows X and per-series Y values. Default false - opt-in
because the overlay competes with per-marker click / hover handlers
(markers above the overlay still receive their own events; bare
plot space drives the crosshair).
[Parameter]
public bool ShowCrosshair { get; set; }
Property Value
- bool
ShowMarkers
When true a small filled circle is drawn at each data point
(also serves as the hover target for the native SVG <title>
tooltip). Defaults to true.
[Parameter]
public bool ShowMarkers { get; set; }
Property Value
- bool
Smooth
When true the line is drawn as a smooth Catmull-Rom curve
instead of a straight polyline. Defaults to false (polyline)
because abrupt changes in data are visually clearer that way.
[Parameter]
public bool Smooth { get; set; }
Property Value
- bool
Sparkline
Sparkline mode: hides axes, grid, tick labels, legend and tooltip
title - only the line stroke (and optional markers) renders. Pair
with a small Width / Height (e.g. 120×32) to embed
inline in tables, KPI cards, or list rows. Default false.
[Parameter]
public bool Sparkline { get; set; }
Property Value
- bool
Stacked
When true, series are stacked: each series' Y at every X is
the cumulative sum of its own value plus every previous series' Y at
the same X. The line stroke (and area fill, in
BOBAreaChart<TX, TY>) follows the cumulative total
instead of raw values. Default false.
Useful for "decomposition" charts where the message is the total trajectory broken down by component (revenue by region over time, CPU usage by container). For bar charts use the analogous StackMode parameter.
[Parameter]
public bool Stacked { get; set; }
Property Value
- bool
StreamingFollow
When the user has zoomed in and a streaming append produces an X
past the current visible window, slide the zoom range forward by
the overflow so the newest point stays in view. Default true.
[Parameter]
public bool StreamingFollow { get; set; }
Property Value
- bool
StreamingPaused
When true,
AppendPointsAsync(string, IEnumerable<BOBChartPoint<TX, TY>>)
still updates the internal buffer but the chart does NOT re-render
(the next non-paused append flushes the visible state). Use to
freeze the view while inspecting a moving target. Default false.
[Parameter]
public bool StreamingPaused { get; set; }
Property Value
- bool
StreamingThrottle
Optional debounce window: when set, rapid back-to-back
AppendPointsAsync calls coalesce into a single re-render
after this delay since the last append. null (default)
re-renders immediately on every append.
[Parameter]
public TimeSpan? StreamingThrottle { get; set; }
Property Value
- TimeSpan?
StreamingWindow
Maximum number of points kept per series in the streaming buffer
(combined parameter Series + appended). When the
combined length exceeds this value the oldest points are evicted
FIFO. null = unlimited. Effective only after the first
streaming append; pure parameter-driven series ignore the window.
[Parameter]
public int? StreamingWindow { get; set; }
Property Value
- int?
XAxis
Configuration for the horizontal axis.
[Parameter]
public BOBChartAxis XAxis { get; set; }
Property Value
YAxis
Configuration for the vertical axis.
[Parameter]
public BOBChartAxis YAxis { get; set; }
Property Value
ZoomEnabled
When true, the chart enables wheel-to-zoom and double-click-
to-reset on the X axis. Mouse wheel up zooms in 10% around the
cursor X; wheel down zooms out 10%. Double-click clears the zoom
and reverts to the data extent. Default false.
Only effective when the X axis is continuous (numeric or temporal); categorical X axes have no continuous coordinate to zoom into.
[Parameter]
public bool ZoomEnabled { get; set; }
Property Value
- bool
Methods
AppendPointsAsync(string, params BOBChartPoint<TX, TY>[])
Append a single point to the streaming buffer for the named series.
On first call seeds the buffer from the matching Series
entry's Points; subsequent appends extend the buffer.
public Task AppendPointsAsync(string seriesLabel, params BOBChartPoint<TX, TY>[] points)
Parameters
seriesLabelstringpointsBOBChartPoint<TX, TY>[]
Returns
- Task
AppendPointsAsync(string, IEnumerable<BOBChartPoint<TX, TY>>)
Append a batch of points. Honors StreamingWindow (FIFO trim), StreamingFollow (slide zoom window), StreamingPaused (defer render), and StreamingThrottle (debounce render).
public Task AppendPointsAsync(string seriesLabel, IEnumerable<BOBChartPoint<TX, TY>> points)
Parameters
seriesLabelstringpointsIEnumerable<BOBChartPoint<TX, TY>>
Returns
- Task
BuildAriaLabel()
Default ARIA label for the chart's <svg> root. Subclasses
override to inject series / value summaries (improves screen-reader
experience).
protected override string BuildAriaLabel()
Returns
- string
BuildPolylinePath(IReadOnlyList<(double X, double Y)>)
Build an SVG path d attribute as a polyline:
"M x0,y0 L x1,y1 L x2,y2 …".
protected static string BuildPolylinePath(IReadOnlyList<(double X, double Y)> points)
Parameters
pointsIReadOnlyList<(double X, double Y)>
Returns
- string
BuildSmoothPath(IReadOnlyList<(double X, double Y)>)
Build an SVG path d attribute as a smooth Catmull-Rom-like
cubic bezier curve. Uses the midpoint-derivative simplification:
each pair of consecutive points becomes a cubic with control points
derived from the segment's neighbours, yielding C¹ continuity at
data points without overshoot.
protected static string BuildSmoothPath(IReadOnlyList<(double X, double Y)> points)
Parameters
pointsIReadOnlyList<(double X, double Y)>
Returns
- string
ClearStreamingAsync()
Drop the streaming buffer for every series. The next render reverts to the parameter-supplied Series data.
public Task ClearStreamingAsync()
Returns
- Task
RenderSvg(RenderTreeBuilder)
Concrete charts override this to emit SVG content. The supplied
builder is positioned inside the <svg> root, so
implementations only need to add geometry primitives (lines, paths,
rects, text). Sequence numbers must remain unique within the override.
protected override void RenderSvg(RenderTreeBuilder builder)
Parameters
builderRenderTreeBuilderRender tree builder positioned inside the SVG root.
ResetSeriesAsync(string, IEnumerable<BOBChartPoint<TX, TY>>)
Replace the streaming buffer for a series with the given snapshot. Useful when a server push delivers a corrected/recomputed window.
public Task ResetSeriesAsync(string seriesLabel, IEnumerable<BOBChartPoint<TX, TY>> points)
Parameters
seriesLabelstringpointsIEnumerable<BOBChartPoint<TX, TY>>
Returns
- Task
ResetZoom()
Reset the X-axis zoom to the full data extent. Public so consumers can wire a "Reset" button outside the chart frame.
public void ResetZoom()