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
valuedoublecolorColorlineCharcharlabelstringlabelPositionLabelPosition
Returns
AddSeries(string, Color, ColorGradient?)
Adds a named data series.
public LineGraphBuilder AddSeries(string name, Color color, ColorGradient? gradient = null)
Parameters
namestringSeries name.
colorColorLine color.
gradientColorGradientOptional color gradient.
Returns
AddSeries(string, Color, string)
Adds a named data series with a gradient specification string.
public LineGraphBuilder AddSeries(string name, Color color, string gradientSpec)
Parameters
namestringSeries name.
colorColorLine color.
gradientSpecstringGradient specification (e.g., "cool", "blue→cyan").
Returns
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
valuedoublelabelstringarrowColorColorlabelColorColorsideMarkerSide
Returns
Build()
Builds the LineGraphControl instance.
public LineGraphControl Build()
Returns
Stretch()
Sets alignment to stretch to fill available width.
public LineGraphBuilder Stretch()
Returns
Visible(bool)
Sets the visibility.
public LineGraphBuilder Visible(bool visible)
Parameters
visiblebool
Returns
WithAlignment(HorizontalAlignment)
Sets the horizontal alignment.
public LineGraphBuilder WithAlignment(HorizontalAlignment alignment)
Parameters
alignmentHorizontalAlignment
Returns
WithAutoFitDataPoints(bool)
Enables auto-fitting max data points to match the rendered width.
public LineGraphBuilder WithAutoFitDataPoints(bool autoFit = true)
Parameters
autoFitbool
Returns
WithAxisLabelColor(Color)
Sets the color of Y-axis labels.
public LineGraphBuilder WithAxisLabelColor(Color color)
Parameters
colorColor
Returns
WithBackgroundColor(Color)
Sets the background color.
public LineGraphBuilder WithBackgroundColor(Color color)
Parameters
colorColor
Returns
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
showboolWhether to show the baseline.
baselineCharcharCharacter to use for the baseline.
colorColor?Color for the baseline.
positionTitlePositionPosition of the baseline.
Returns
WithBorder(BorderStyle)
Sets the border style.
public LineGraphBuilder WithBorder(BorderStyle style)
Parameters
styleBorderStyle
Returns
WithBorder(BorderStyle, Color)
Sets the border style and color.
public LineGraphBuilder WithBorder(BorderStyle style, Color color)
Parameters
styleBorderStylecolorColor
Returns
WithData(IEnumerable<double>)
Sets data for a single-series graph (auto-creates default series).
public LineGraphBuilder WithData(IEnumerable<double> data)
Parameters
dataIEnumerable<double>The data points.
Returns
WithData(string, IEnumerable<double>)
Sets data for a named series.
public LineGraphBuilder WithData(string seriesName, IEnumerable<double> data)
Parameters
seriesNamestringThe series name.
dataIEnumerable<double>The data points.
Returns
WithHeight(int)
Sets the graph height in lines.
public LineGraphBuilder WithHeight(int height)
Parameters
heightint
Returns
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
showboolhighColorColor?lowColorColor?sideMarkerSide
Returns
WithInlineTitleBaseline(bool)
Sets whether to show the title inline with the baseline.
public LineGraphBuilder WithInlineTitleBaseline(bool inline = true)
Parameters
inlinebool
Returns
WithMargin(Margin)
Sets the margin.
public LineGraphBuilder WithMargin(Margin margin)
Parameters
marginMargin
Returns
WithMargin(int, int, int, int)
Sets the margin.
public LineGraphBuilder WithMargin(int left, int top, int right, int bottom)
Parameters
Returns
WithMaxDataPoints(int)
Sets the maximum number of data points per series.
public LineGraphBuilder WithMaxDataPoints(int maxPoints)
Parameters
maxPointsint
Returns
WithMaxValue(double)
Sets the fixed maximum Y-axis value.
public LineGraphBuilder WithMaxValue(double maxValue)
Parameters
maxValuedouble
Returns
WithMinValue(double)
Sets the fixed minimum Y-axis value.
public LineGraphBuilder WithMinValue(double minValue)
Parameters
minValuedouble
Returns
WithMode(LineGraphMode)
Sets the rendering mode (Braille or Ascii).
public LineGraphBuilder WithMode(LineGraphMode mode)
Parameters
modeLineGraphMode
Returns
WithName(string)
Sets the control name.
public LineGraphBuilder WithName(string name)
Parameters
namestring
Returns
WithTitle(string)
Sets the title.
public LineGraphBuilder WithTitle(string title)
Parameters
titlestring
Returns
WithTitle(string, Color)
Sets the title and color.
public LineGraphBuilder WithTitle(string title, Color color)
Parameters
Returns
WithTitlePosition(TitlePosition)
Sets the title position.
public LineGraphBuilder WithTitlePosition(TitlePosition position)
Parameters
positionTitlePosition
Returns
WithVerticalAlignment(VerticalAlignment)
Sets the vertical alignment.
public LineGraphBuilder WithVerticalAlignment(VerticalAlignment alignment)
Parameters
alignmentVerticalAlignment
Returns
WithWidth(int)
Sets the width.
public LineGraphBuilder WithWidth(int width)
Parameters
widthint
Returns
WithYAxisLabels(bool, string?)
Enables or disables Y-axis labels with optional format string.
public LineGraphBuilder WithYAxisLabels(bool show = true, string? format = null)