Sparkline
Description
A compact inline trend chart
Sparkline renders a compact SVG area chart designed to be embedded alongside metric values, table cells, or dashboard cards. It conveys the shape of a trend at a glance without axes, labels, or interactive controls.
The chart accepts a data array of doubles and optional width, height, and color parameters, making it easy to match any layout or brand color.
Samples
Upward Trend
Downward Trend
Flat / Stable
Volatile / Random
Primary Color (default)
Larger Chart
Dashboard Card with Metric and Sparkline
Sparklines are most useful when paired with a headline metric. The cards below combine a primary number, the period-over-period delta, and a sparkline for shape — each tile uses a different palette to highlight the trend direction.
Dynamic Sparkline (Refresh on Click)
Sparkline re-renders whenever it is added to a container, so you can drive interactivity by swapping the chart for a new instance on a user action. The button below replaces the current chart with a freshly-randomised data set.
API reference
public class Sparkline : IComponentA tiny inline line chart used to show a trend without occupying chart-sized real-estate.
- Namespace
- Tesserae
- Implements
- IComponent
Constructors
| Name | Description |
|---|---|
| Sparkline | Initializes a new instance of this class. |
Methods
| Name | Description |
|---|---|
| StrokeWidth | Sets the width of the line, in pixels. The line keeps that width when the chart is stretched to fill its row, rather than being scaled with the drawing. |
| Fill | Turns the tinted area under the line on or off. On by default. |
| EndMarker | Marks the last point of the series with a dot in the line's colour - the "this week" end of a trend that runs up to now. |
| ReferenceLine | Draws a dotted horizontal line across the chart at the given value - a target, a threshold or a baseline the trend should be read against. A value outside the range of the series is clamped to the nearest edge of the chart. |
| Render | Renders the component's root HTML element. |
public Sparkline StrokeWidth(double width)Sets the width of the line, in pixels. The line keeps that width when the chart is stretched to fill its row, rather than being scaled with the drawing.
public Sparkline Fill(bool value = true)Turns the tinted area under the line on or off. On by default.
public Sparkline EndMarker(bool value = true)Marks the last point of the series with a dot in the line's colour - the "this week" end of a trend that runs up to now.
| Overload | |
|---|---|
| ReferenceLine(double) | Draws a dotted horizontal line across the chart at the given value - a target, a threshold or a baseline the trend should be read against. A value outside the range of the series is clamped to the nearest edge of the chart. |
| ReferenceLine() | Draws a dotted horizontal line across the chart at the mean of the series. |
ReferenceLine(double)
public Sparkline ReferenceLine(double value)Draws a dotted horizontal line across the chart at the given value - a target, a threshold or a baseline the trend should be read against. A value outside the range of the series is clamped to the nearest edge of the chart.
Parameters
- value double