ScatterChartWidget<T>
Namespace: Hex1b.Widgets
Assembly: Hex1b.dll
A widget that displays a scatter plot using braille characters for sub-cell precision.
public sealed record ScatterChartWidget<T> : Hex1bWidget, IEquatable<Hex1bWidget>, IEquatable<ScatterChartWidget<T>>Inheritance
Object → Hex1bWidget → ScatterChartWidget<T>
Implements
Properties
Data
Gets the data source for the chart.
Returns: IReadOnlyList<<T>>
public IReadOnlyList<T>? Data { get; init; }Methods
FormatX(Func<double, string>)
Sets a custom X value formatter.
Parameters:
formatter(Func<Double, String>):
Returns: ScatterChartWidget`1
public ScatterChartWidget<T> FormatX(Func<double, string> formatter)FormatY(Func<double, string>)
Sets a custom Y value formatter.
Parameters:
formatter(Func<Double, String>):
Returns: ScatterChartWidget`1
public ScatterChartWidget<T> FormatY(Func<double, string> formatter)GroupBy(Func<T, string>)
Sets the function that groups data into color-coded series.
Parameters:
groupSelector(Func<<T>, String>):
Returns: ScatterChartWidget`1
public ScatterChartWidget<T> GroupBy(Func<T, string> groupSelector)ShowGridLines(bool)
Sets whether to display grid lines.
Parameters:
show(Boolean):
Returns: ScatterChartWidget`1
public ScatterChartWidget<T> ShowGridLines(bool show = true)Title(string)
Sets the chart title.
Parameters:
title(String):
Returns: ScatterChartWidget`1
public ScatterChartWidget<T> Title(string title)X(Func<T, double>)
Sets the function that extracts the X-axis value from each data item.
Parameters:
selector(Func<<T>, Double>):
Returns: ScatterChartWidget`1
public ScatterChartWidget<T> X(Func<T, double> selector)XRange(double, double)
Sets the explicit X-axis range.
Parameters:
Returns: ScatterChartWidget`1
public ScatterChartWidget<T> XRange(double min, double max)Y(Func<T, double>)
Sets the function that extracts the Y-axis value from each data item.
Parameters:
selector(Func<<T>, Double>):
Returns: ScatterChartWidget`1
public ScatterChartWidget<T> Y(Func<T, double> selector)YRange(double, double)
Sets the explicit Y-axis range.
Parameters:
Returns: ScatterChartWidget`1
public ScatterChartWidget<T> YRange(double min, double max)Remarks
Points are NOT connected by lines. Each data point plots a single braille dot. Multiple series can be created via to color-code groups.
Examples
Create a scatter chart with grouped series:
var app = new Hex1bApp(ctx =>
ctx.ScatterChart(data)
.X(d => d.Height)
.Y(d => d.Weight)
.GroupBy(d => d.Category)
.Title("Height vs Weight")
);