Table of Contents

Class LineGraphBuilder

Namespace
SharpConsoleUI.Builders
Assembly
SharpConsoleUI.dll

Fluent builder for creating LineGraphControl instances.

public class LineGraphBuilder : IControlBuilder<LineGraphControl>
Inheritance
LineGraphBuilder
Implements
Inherited Members
Extension Methods

Constructors

LineGraphBuilder()

Initializes a new instance of the LineGraphBuilder class.

public LineGraphBuilder()

Methods

AddReferenceLine(double, Color, char, string?, LabelPosition)

Adds a horizontal reference line at the specified data value.

public LineGraphBuilder AddReferenceLine(double value, Color color, char lineChar = '─', string? label = null, LabelPosition labelPosition = LabelPosition.None)

Parameters

value double
color Color
lineChar char
label string
labelPosition LabelPosition

Returns

LineGraphBuilder

AddSeries(string, Color, ColorGradient?)

Adds a named data series.

public LineGraphBuilder AddSeries(string name, Color color, ColorGradient? gradient = null)

Parameters

name string

Series name.

color Color

Line color.

gradient ColorGradient

Optional color gradient.

Returns

LineGraphBuilder

AddSeries(string, Color, string)

Adds a named data series with a gradient specification string.

public LineGraphBuilder AddSeries(string name, Color color, string gradientSpec)

Parameters

name string

Series name.

color Color

Line color.

gradientSpec string

Gradient specification (e.g., "cool", "blue→cyan").

Returns

LineGraphBuilder

AddValueMarker(double, string, Color, Color, MarkerSide)

Adds a value marker at the specified data value.

public LineGraphBuilder AddValueMarker(double value, string label, Color arrowColor, Color labelColor, MarkerSide side = MarkerSide.Right)

Parameters

value double
label string
arrowColor Color
labelColor Color
side MarkerSide

Returns

LineGraphBuilder

Build()

Builds the LineGraphControl instance.

public LineGraphControl Build()

Returns

LineGraphControl

Stretch()

Sets alignment to stretch to fill available width.

public LineGraphBuilder Stretch()

Returns

LineGraphBuilder

Visible(bool)

Sets the visibility.

public LineGraphBuilder Visible(bool visible)

Parameters

visible bool

Returns

LineGraphBuilder

WithAlignment(HorizontalAlignment)

Sets the horizontal alignment.

public LineGraphBuilder WithAlignment(HorizontalAlignment alignment)

Parameters

alignment HorizontalAlignment

Returns

LineGraphBuilder

WithAutoFitDataPoints(bool)

Enables auto-fitting max data points to match the rendered width.

public LineGraphBuilder WithAutoFitDataPoints(bool autoFit = true)

Parameters

autoFit bool

Returns

LineGraphBuilder

WithAxisLabelColor(Color)

Sets the color of Y-axis labels.

public LineGraphBuilder WithAxisLabelColor(Color color)

Parameters

color Color

Returns

LineGraphBuilder

WithBackgroundColor(Color)

Sets the background color.

public LineGraphBuilder WithBackgroundColor(Color color)

Parameters

color Color

Returns

LineGraphBuilder

WithBaseline(bool, char, Color?, TitlePosition)

Enables or disables the baseline with optional customization.

public LineGraphBuilder WithBaseline(bool show = true, char baselineChar = '┈', Color? color = null, TitlePosition position = TitlePosition.Bottom)

Parameters

show bool

Whether to show the baseline.

baselineChar char

Character to use for the baseline.

color Color?

Color for the baseline.

position TitlePosition

Position of the baseline.

Returns

LineGraphBuilder

WithBorder(BorderStyle)

Sets the border style.

public LineGraphBuilder WithBorder(BorderStyle style)

Parameters

style BorderStyle

Returns

LineGraphBuilder

WithBorder(BorderStyle, Color)

Sets the border style and color.

public LineGraphBuilder WithBorder(BorderStyle style, Color color)

Parameters

style BorderStyle
color Color

Returns

LineGraphBuilder

WithData(IEnumerable<double>)

Sets data for a single-series graph (auto-creates default series).

public LineGraphBuilder WithData(IEnumerable<double> data)

Parameters

data IEnumerable<double>

The data points.

Returns

LineGraphBuilder

WithData(string, IEnumerable<double>)

Sets data for a named series.

public LineGraphBuilder WithData(string seriesName, IEnumerable<double> data)

Parameters

seriesName string

The series name.

data IEnumerable<double>

The data points.

Returns

LineGraphBuilder

WithHeight(int)

Sets the graph height in lines.

public LineGraphBuilder WithHeight(int height)

Parameters

height int

Returns

LineGraphBuilder

WithHighLowLabels(bool, Color?, Color?, MarkerSide)

Enables high/low labels with the specified colors and side.

public LineGraphBuilder WithHighLowLabels(bool show = true, Color? highColor = null, Color? lowColor = null, MarkerSide side = MarkerSide.Right)

Parameters

show bool
highColor Color?
lowColor Color?
side MarkerSide

Returns

LineGraphBuilder

WithInlineTitleBaseline(bool)

Sets whether to show the title inline with the baseline.

public LineGraphBuilder WithInlineTitleBaseline(bool inline = true)

Parameters

inline bool

Returns

LineGraphBuilder

WithMargin(Margin)

Sets the margin.

public LineGraphBuilder WithMargin(Margin margin)

Parameters

margin Margin

Returns

LineGraphBuilder

WithMargin(int, int, int, int)

Sets the margin.

public LineGraphBuilder WithMargin(int left, int top, int right, int bottom)

Parameters

left int
top int
right int
bottom int

Returns

LineGraphBuilder

WithMaxDataPoints(int)

Sets the maximum number of data points per series.

public LineGraphBuilder WithMaxDataPoints(int maxPoints)

Parameters

maxPoints int

Returns

LineGraphBuilder

WithMaxValue(double)

Sets the fixed maximum Y-axis value.

public LineGraphBuilder WithMaxValue(double maxValue)

Parameters

maxValue double

Returns

LineGraphBuilder

WithMinValue(double)

Sets the fixed minimum Y-axis value.

public LineGraphBuilder WithMinValue(double minValue)

Parameters

minValue double

Returns

LineGraphBuilder

WithMode(LineGraphMode)

Sets the rendering mode (Braille or Ascii).

public LineGraphBuilder WithMode(LineGraphMode mode)

Parameters

mode LineGraphMode

Returns

LineGraphBuilder

WithName(string)

Sets the control name.

public LineGraphBuilder WithName(string name)

Parameters

name string

Returns

LineGraphBuilder

WithTitle(string)

Sets the title.

public LineGraphBuilder WithTitle(string title)

Parameters

title string

Returns

LineGraphBuilder

WithTitle(string, Color)

Sets the title and color.

public LineGraphBuilder WithTitle(string title, Color color)

Parameters

title string
color Color

Returns

LineGraphBuilder

WithTitlePosition(TitlePosition)

Sets the title position.

public LineGraphBuilder WithTitlePosition(TitlePosition position)

Parameters

position TitlePosition

Returns

LineGraphBuilder

WithVerticalAlignment(VerticalAlignment)

Sets the vertical alignment.

public LineGraphBuilder WithVerticalAlignment(VerticalAlignment alignment)

Parameters

alignment VerticalAlignment

Returns

LineGraphBuilder

WithWidth(int)

Sets the width.

public LineGraphBuilder WithWidth(int width)

Parameters

width int

Returns

LineGraphBuilder

WithYAxisLabels(bool, string?)

Enables or disables Y-axis labels with optional format string.

public LineGraphBuilder WithYAxisLabels(bool show = true, string? format = null)

Parameters

show bool
format string

Returns

LineGraphBuilder