Skip to content

LinePlot

ClassChartGuruChartGuru
public class LinePlot : ChartMark, IChartMark

A vectorized line plot that renders a mathematical function. Swift Charts equivalent: LinePlot(x: “x”, y: .linearFunction(intercept: 0, slope: 1))

Unlike LineMark which requires explicit data points, LinePlot samples a function over a domain to generate a smooth curve.

LinePlot(Func<float, float>, float, float)

Section titled “LinePlot(Func<float, float>, float, float)”
public LinePlot(Func<float, float> function, float domainMin = 0, float domainMax = 1)

Creates a LinePlot with a function and domain.

Parameters

Name Type
function System.Func{System.Single,System.Single}
domainMin System.Single
domainMax System.Single

LinearFunction(float, float, float, float)

Section titled “LinearFunction(float, float, float, float)”
public static LinePlot LinearFunction(float intercept, float slope, float domainMin = 0, float domainMax = 1)

Creates a linear function plot: y = slope * x + intercept Swift Charts equivalent: LinePlot(x: “x”, y: .linearFunction(intercept:slope:))

Parameters

Name Type
intercept System.Single
slope System.Single
domainMin System.Single
domainMax System.Single

Returns

ChartGuru.LinePlot

QuadraticFunction(float, float, float, float, float)

Section titled “QuadraticFunction(float, float, float, float, float)”
public static LinePlot QuadraticFunction(float a, float b, float c, float domainMin = 0, float domainMax = 1)

Creates a quadratic function plot: y = ax² + bx + c

Parameters

Name Type
a System.Single
b System.Single
c System.Single
domainMin System.Single
domainMax System.Single

Returns

ChartGuru.LinePlot

SineWave(float, float, float, float, float)

Section titled “SineWave(float, float, float, float, float)”
public static LinePlot SineWave(float amplitude = 1, float frequency = 1, float phase = 0, float domainMin = 0, float domainMax = 6.28)

Creates a sine wave plot.

Parameters

Name Type
amplitude System.Single
frequency System.Single
phase System.Single
domainMin System.Single
domainMax System.Single

Returns

ChartGuru.LinePlot

CosineWave(float, float, float, float, float)

Section titled “CosineWave(float, float, float, float, float)”
public static LinePlot CosineWave(float amplitude = 1, float frequency = 1, float phase = 0, float domainMin = 0, float domainMax = 6.28)

Creates a cosine wave plot.

Parameters

Name Type
amplitude System.Single
frequency System.Single
phase System.Single
domainMin System.Single
domainMax System.Single

Returns

ChartGuru.LinePlot

ExponentialFunction(float, float, float, float)

Section titled “ExponentialFunction(float, float, float, float)”
public static LinePlot ExponentialFunction(float a = 1, float b = 1, float domainMin = 0, float domainMax = 2)

Creates an exponential function plot: y = a * e^(b*x)

Parameters

Name Type
a System.Single
b System.Single
domainMin System.Single
domainMax System.Single

Returns

ChartGuru.LinePlot

LogarithmicFunction(float, float, float, float)

Section titled “LogarithmicFunction(float, float, float, float)”
public static LinePlot LogarithmicFunction(float a = 1, float b = 0, float domainMin = 0.1, float domainMax = 10)

Creates a logarithmic function plot: y = a * ln(x) + b

Parameters

Name Type
a System.Single
b System.Single
domainMin System.Single
domainMax System.Single

Returns

ChartGuru.LinePlot

public IEnumerable<LineMark> GetSampledMarks()

Samples the function and generates LineMark data points.

Returns

System.Collections.Generic.IEnumerable{ChartGuru.LineMark}

public IEnumerable<DataPoint> GetSampledPoints()

Gets the sampled data points.

Returns

System.Collections.Generic.IEnumerable{ChartGuru.DataPoint}

public LinePlot Domain(float min, float max)

Sets the Domain (X range) for sampling.

Parameters

Name Type
min System.Single
max System.Single

Returns

ChartGuru.LinePlot

public LinePlot Samples(int count)

Sets the number of sample points.

Parameters

Name Type
count System.Int32

Returns

ChartGuru.LinePlot

public LinePlot InterpolationMethod(InterpolationMethod method)

Sets the interpolation method.

Parameters

Name Type
method ChartGuru.InterpolationMethod

Returns

ChartGuru.LinePlot

public LinePlot LineStyle(float width)

Sets the line width.

Parameters

Name Type
width System.Single

Returns

ChartGuru.LinePlot

public LinePlot ForegroundStyle(Color color)

Sets the foreground color. Swift Charts equivalent: .ForegroundStyle(color)

Parameters

Name Type
color UnityEngine.Color

Returns

ChartGuru.LinePlot

public LinePlot Symbol(SymbolShape shape, float size = 4)

Shows points at each sample.

Parameters

Name Type
shape ChartGuru.SymbolShape
size System.Single

Returns

ChartGuru.LinePlot

public LinePlot Symbol(SymbolStyle style, float size = 4)

Shows stroked-border points at each sample. Swift Charts equivalent: .Symbol(.circle.StrokeBorder(lineWidth: 2)).

Parameters

Name Type
style ChartGuru.SymbolStyle
size System.Single

Returns

ChartGuru.LinePlot

public override (Vector2 source, Vector2 target) GetMorphTargets(ChartType targetType, Rect plotArea)

Projects this mark into plot-space geometry that the morph renderer can interpolate toward the requested chart type.

Parameters

Name Type
targetType ChartGuru.ChartType
plotArea UnityEngine.Rect

Returns

System.ValueTuple{UnityEngine.Vector2,UnityEngine.Vector2}

public override IChartMark Clone()

Creates an independent copy of this Line Plot; later configuration changes do not affect the original instance.

Returns

ChartGuru.IChartMark

public override ChartType MarkType { get; }

Returns

ChartGuru.ChartType

public Func<float, float> Function { get; set; }

The function to plot: y = f(x)

Returns

System.Func{System.Single,System.Single}

public float DomainMin { get; set; }

Minimum X value for sampling.

Returns

System.Single

public float DomainMax { get; set; }

Maximum X value for sampling.

Returns

System.Single

public int SampleCount { get; set; }

Number of sample points to generate. Higher values produce smoother curves.

Returns

System.Int32

public InterpolationMethod Interpolation { get; set; }

Returns

ChartGuru.InterpolationMethod

public float LineWidth { get; set; }

Returns

System.Single

public bool ShowPoints { get; set; }

Returns

System.Boolean

public SymbolShape PointSymbol { get; set; }

Returns

ChartGuru.SymbolShape

public float PointSize { get; set; }

Returns

System.Single