Sparkline
ConsoleMonster.Widgets
A compact trend of recent values: ▁▂▄▆█▇▅ on Full, shades on Basic, an ASCII ramp on Ascii. With Sparkline.Height above 1 it becomes a small area chart. The newest value is on the right and can be shown as a number. Live operation: add (Value).
Inheritance
- LiveWidget
- Sparkline
Usage
Explore 44 API references to this type
This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.
Returned or exposed by 22
- Method Ui.Sparkline
- Extension method Sparkline.Capacity
- Extension method Sparkline.Height
- Extension method Sparkline.Label
- Extension method Sparkline.Labels
- Extension method Sparkline.Maximum
- Extension method Sparkline.Role
- Extension method Sparkline.ShowLatest
- Extension method Sparkline.Title
- Extension method Sparkline.Unit
- Extension method Sparkline.Values
- Method Sparkline.Add
- Method SparklineFluent.Capacity
- Method SparklineFluent.Height
- Method SparklineFluent.Label
- Method SparklineFluent.Labels
- Method SparklineFluent.Maximum
- Method SparklineFluent.Role
- Method SparklineFluent.ShowLatest
- Method SparklineFluent.Title
- Method SparklineFluent.Unit
- Method SparklineFluent.Values
Accepted by parameters 22
- Method ContentBuilder.Sparkline
- Method ContentBuilder.Sparkline
- Extension method Sparkline.Capacity
- Extension method Sparkline.Height
- Extension method Sparkline.Label
- Extension method Sparkline.Labels
- Extension method Sparkline.Maximum
- Extension method Sparkline.Role
- Extension method Sparkline.ShowLatest
- Extension method Sparkline.Title
- Extension method Sparkline.Unit
- Extension method Sparkline.Values
- Method SparklineFluent.Capacity
- Method SparklineFluent.Height
- Method SparklineFluent.Label
- Method SparklineFluent.Labels
- Method SparklineFluent.Maximum
- Method SparklineFluent.Role
- Method SparklineFluent.ShowLatest
- Method SparklineFluent.Title
- Method SparklineFluent.Unit
- Method SparklineFluent.Values
Constructors
public Sparkline(string widgetId = "sparkline") #Creates a sparkline.
Parameters
- widgetId string = "sparkline"
- The live name (default sparkline).
Methods
public override void Apply(LiveEvent liveEvent) #Applies an event to the widget's state.
Parameters
- liveEvent ConsoleMonster.Live.LiveEvent
- The event.
public SparklineHandle Handle(ILiveDispatcher dispatcher) #Returns a handle that appends values through a dispatcher.
Parameters
- dispatcher ConsoleMonster.Live.ILiveDispatcher
- The dispatcher.
public override Size Measure(Constraints constraints, RenderContext context) #Returns the size the widget wants within the constraints.
Parameters
- constraints ConsoleMonster.Layout.Constraints
- The space offered.
- context ConsoleMonster.Canvas.RenderContext
- Profile, theme and glyphs.
public override void Render(Region region, RenderContext context) #Renders into a region. The region may be smaller or larger than the measured size.
Parameters
- region ConsoleMonster.Canvas.Region
- The target region.
- context ConsoleMonster.Canvas.RenderContext
- Profile, theme and glyphs.
Inherited Methods
public virtual string? Describe(LiveEvent liveEvent) #Parameters
- liveEvent LiveEvent
Returns
string?Properties
public IList<string> Labels { get; } #Optional point labels in value order; labelled trends show an axis and their peak.
public bool ShowLatest { get; set; } #Whether the latest value is shown on the right (default true).
public double? Maximum { get; set; } #A fixed maximum, or null to scale to the visible values.
Inherited Properties
Extension Methods
public static Sparkline Capacity(Sparkline sparkline, int value) #Sets Sparkline.Capacity: How many values are kept (default 1024).
Parameters
- sparkline ConsoleMonster.Widgets.Sparkline
- The instance.
- value int
- The value.
Examples
// C# initializer or property // C# fluent
new global::ConsoleMonster.Widgets.Sparkline { Capacity = value }; Ui.Sparkline().Capacity(value);public static Sparkline Height(Sparkline sparkline, int value) #Sets Sparkline.Height: Rows (default 1).
Parameters
- sparkline ConsoleMonster.Widgets.Sparkline
- The instance.
- value int
- The value.
Examples
// C# initializer or property // C# fluent
new global::ConsoleMonster.Widgets.Sparkline { Height = value }; Ui.Sparkline().Height(value);public static Sparkline Label(Sparkline sparkline, string item) #Adds an item to Sparkline.Labels: Optional point labels in value order; labelled trends show an axis and their peak.
Parameters
- sparkline ConsoleMonster.Widgets.Sparkline
- The instance.
- item string
- The item.
public static Sparkline Labels(Sparkline sparkline, IEnumerable<string> items) #Adds items to Sparkline.Labels: Optional point labels in value order; labelled trends show an axis and their peak.
Parameters
- sparkline ConsoleMonster.Widgets.Sparkline
- The instance.
- items System.Collections.Generic.IEnumerable<string>
- The items, in order.
public static Sparkline Maximum(Sparkline sparkline, double? value) #Sets Sparkline.Maximum: A fixed maximum, or null to scale to the visible values.
Parameters
- sparkline ConsoleMonster.Widgets.Sparkline
- The instance.
- value double?
- The value.
Examples
// C# initializer or property // C# fluent
new global::ConsoleMonster.Widgets.Sparkline { Maximum = value }; Ui.Sparkline().Maximum(value);public static Sparkline Role(Sparkline sparkline, ThemeToken value) #Sets Sparkline.Role: The colour role (default ThemeToken.Accent).
Parameters
- sparkline ConsoleMonster.Widgets.Sparkline
- The instance.
- value ConsoleMonster.Styling.ThemeToken
- The value.
Examples
// C# initializer or property // C# fluent
new global::ConsoleMonster.Widgets.Sparkline { Role = value }; Ui.Sparkline().Role(value);public static Sparkline ShowLatest(Sparkline sparkline, bool value = true) #Sets Sparkline.ShowLatest: Whether the latest value is shown on the right (default true).
Parameters
- sparkline ConsoleMonster.Widgets.Sparkline
- The instance.
- value bool = true
- The value; true when omitted.
Examples
// C# initializer or property // C# fluent
new global::ConsoleMonster.Widgets.Sparkline { ShowLatest = value }; Ui.Sparkline().ShowLatest(value);public static Sparkline Title(Sparkline sparkline, string? value) #Sets Sparkline.Title: A caption shown on the left (markup), or null.
Parameters
- sparkline ConsoleMonster.Widgets.Sparkline
- The instance.
- value string?
- The value.
Examples
// C# initializer or property // C# fluent
new global::ConsoleMonster.Widgets.Sparkline { Title = value }; Ui.Sparkline().Title(value);public static Sparkline Unit(Sparkline sparkline, string? value) #Sets Sparkline.Unit: A unit appended to the latest value.
Parameters
- sparkline ConsoleMonster.Widgets.Sparkline
- The instance.
- value string?
- The value.
Examples
// C# initializer or property // C# fluent
new global::ConsoleMonster.Widgets.Sparkline { Unit = value }; Ui.Sparkline().Unit(value);public static Sparkline Values(Sparkline sparkline, IEnumerable<double> values) #Appends several values.
Parameters
- sparkline ConsoleMonster.Widgets.Sparkline
- The sparkline.
- values System.Collections.Generic.IEnumerable<double>
- The values.