Metric
Description
A component to display a metric
A Metric component displays a key value alongside a title and an optional indicator of change.
Samples
Basic Metrics
Metrics with Change Indicator
Card With Header & Tags
With Tooltips inside title
Metrics with Sparkline Charts
API reference
public class Metric : ComponentBase<Metric, HTMLElement>A large numeric KPI tile used inside dashboards, showing a value with optional label and trend indicator. Beside the number it can lead with an IconTile - the same rounded, tinted square an OmniResult{T} row leads with - saying what is being counted, and it can hold a chart (a Sparkline, a ContributionBar) under the value to show how the number got there.
- Namespace
- Tesserae
- Inheritance
- ComponentBase<Metric, HTMLElement> → Metric
Constructors
| Name | Description |
|---|---|
| Metric | Initializes a new instance of this class. |
| Overload | |
|---|---|
| Metric(string, string) | Initializes a new instance of this class. |
| Metric(IComponent, IComponent) | Initializes a new instance of this class. |
Methods
| Name | Description |
|---|---|
| SetIcon | Puts an icon on a tile in front of the title and the value, in the given color, over a paler wash of that same color - the same tile an OmniResult{T} row leads with. Pass the full-strength color the glyph should be; a null color leaves the tile neutral. |
| IconSize | Sets how big the leading tile is drawn - 44px square by default, which is the size a KPI wants beside a number two lines tall. |
| ValueFirst | Draws the value above the title rather than under it - the shape a counter takes when the number is the point and the words under it only say what was counted ("5 / In my scope"). |
| ChangeInHeader | Pulls the change indicator up onto the title's own line, pushed to its far end - for a card whose trend belongs beside the label rather than under the chart. |
| Chart | Configures the component to chart. |
| Change | Configures the component to change. |
| Render | Renders the component's root HTML element. |
| Overload | |
|---|---|
| SetIcon(UIcons, string, UIconsWeight) | Puts an icon on a tile in front of the title and the value, in the given color, over a paler wash of that same color - the same tile an OmniResult{T} row leads with. Pass the full-strength color the glyph should be; a null color leaves the tile neutral. |
| SetIcon(string, string, TextSize?) | Puts a few letters on the tile in place of a glyph - a unit, a currency, a file type - in the given color, over a paler wash of that same color. |
| SetIcon(IComponent, string) | Puts the given component on the tile - an Image, an Avatar, an emoji. A null value takes the tile away again. |
SetIcon(UIcons, string, UIconsWeight)
public Metric SetIcon(UIcons icon, string color = null, UIconsWeight weight = UIconsWeight.Regular)Puts an icon on a tile in front of the title and the value, in the given color, over a paler wash of that same color - the same tile an OmniResult{T} row leads with. Pass the full-strength color the glyph should be; a null color leaves the tile neutral.
Parameters
- icon UIcons
- color string
- weight UIconsWeight
SetIcon(string, string, TextSize?)
public Metric SetIcon(string text, string color = null, TextSize? size = null)Puts a few letters on the tile in place of a glyph - a unit, a currency, a file type - in the given color, over a paler wash of that same color.
Parameters
- text string
- color string
- size TextSize?
public Metric IconSize(UnitSize size)Sets how big the leading tile is drawn - 44px square by default, which is the size a KPI wants beside a number two lines tall.
public Metric ValueFirst(bool value = true)Draws the value above the title rather than under it - the shape a counter takes when the number is the point and the words under it only say what was counted ("5 / In my scope").
public Metric ChangeInHeader(bool value = true)Pulls the change indicator up onto the title's own line, pushed to its far end - for a card whose trend belongs beside the label rather than under the chart.