Table of Contents

Class FreeformPointLineSeries

Namespace
LightningChartLib.WinForms.Charting.SeriesXY
Assembly
LightningChart.WinForms.Charting.NET4.dll

Freeform point line series. You can define the line and points style. Add points with AddPoints method.

public class FreeformPointLineSeries : PointLineSeriesBase, IChartNode, IDisposable, IHighlightingItem
Inheritance
FreeformPointLineSeries
Implements
Inherited Members

Remarks

The points don't have to be in successive order by X value. If they are used in successive order in your application, you should use PointLineSeries or SampleDataSeries instead for optimal performance. Freeform point line series causes significantly higher CPU/GPU load than other line series types, when the series point count is high.

        Note that the first array is not necessarily the first point of the series, as the Points array is a circular buffer.

Constructors

FreeformPointLineSeries()

Constructor for Form designer list editor.

public FreeformPointLineSeries()

FreeformPointLineSeries(ViewXY, AxisX, AxisY)

Constructor.

public FreeformPointLineSeries(ViewXY owner, AxisX axisX, AxisY axisY)

Parameters

owner ViewXY

Parent.

axisX AxisX

X-axis you want to bind.

axisY AxisY

Y-axis you want to bind.

Properties

CursorTrackEnabled

Cursor tracking enabled.

public bool CursorTrackEnabled { get; set; }

Property Value

bool

ErrorBars

Error bars.

public ErrorBarSettings ErrorBars { get; set; }

Property Value

ErrorBarSettings

IndividualPointColoring

Selects how to use the individual point colors. Sets which PointStyle color is replaced with PointColor.

public PointColoringTarget IndividualPointColoring { get; set; }

Property Value

PointColoringTarget

OldestPointIndex

Gets the index of oldest point in Points array. When PointCountLimitEnabled is true, the Points array is used as an circular point buffer. This is 0 always when PointCountLimitEnabled is false. To read Points, when OldestPointIndex is 0: Read from index 0 till PointCount-1. To read Points, when OldestPointIndex is > 0: First read from OldestPointIndex till PointCountLimit-1. Then read from index 0 till OldestPointIndex-1.

public int OldestPointIndex { get; }

Property Value

int

PointCountLimit

Point count limit. If you add points more than limited count, first points are automatically removed. The limiter only applies if PointCountLimitEnabled is true. If PointCountLimitEnabled is true, the array of corresponding size will be create in memory.

public int PointCountLimit { get; set; }

Property Value

int

PointCountLimitEnabled

Limit point count by dropping oldest points. The point count is limited to PointCountLimit.

public bool PointCountLimitEnabled { get; set; }

Property Value

bool

Points

Series points

public SeriesPoint[] Points { get; set; }

Property Value

SeriesPoint[]

PointsType

Points type

public PointsType PointsType { get; set; }

Property Value

PointsType

PointsWithErrors

Series points with error tolerance indicators

public SeriesErrorPoint[] PointsWithErrors { get; set; }

Property Value

SeriesErrorPoint[]

Methods

AddPoints(SeriesErrorPoint[], bool)

Add points with error tolerance to end of series.

public int AddPoints(SeriesErrorPoint[] points, bool invalidateChart)

Parameters

points SeriesErrorPoint[]

Points.

invalidateChart bool

Update chart after adding. Updating will raise CPU load, so you maybe don't want to use this with every call if points are added many times per second.

Returns

int

Point count after adding.

AddPoints(SeriesPoint[], bool)

Add points to end of series.

public int AddPoints(SeriesPoint[] points, bool invalidateChart)

Parameters

points SeriesPoint[]

Points.

invalidateChart bool

Update chart after adding. Updating will raise CPU load, so you maybe don't want to use this with every call if points are added many times per second.

Returns

int

Point count after adding.

AddPoints(double[], double[], bool)

Add points to end of series.

public int AddPoints(double[] xValues, double[] yValues, bool invalidateChart)

Parameters

xValues double[]

X values.

yValues double[]

Y values.

invalidateChart bool

Update chart after adding. Updating will raise CPU load, so you maybe don't want to use this with every call if points are added many times per second.

Returns

int

Point count after adding.

Clear()

Clear all points

public override void Clear()

Construct()

Create members.

protected override void Construct()

Dispose(bool)

Clean up any resources being used.

protected override void Dispose(bool disposing)

Parameters

disposing bool

true if managed resources should be disposed, otherwise false.

GetLastPoint()

Gets last (newest) point.

public SeriesPoint GetLastPoint()

Returns

SeriesPoint

Last point.

Remarks

This is not the same than reading Points[PointCount-1]. If PointCountLimit is enabled, the Points array is used as ring-buffer. This method returns the newest point.

GetMinMaxFromXRange(out double, out double, double, double, bool)

Get min and max Y value within given X range.

public override bool GetMinMaxFromXRange(out double yMin, out double yMax, double xRangeMin, double xRangeMax, bool ignoreZeros)

Parameters

yMin double

Minimum Y value.

yMax double

Maximum Y value.

xRangeMin double

X range start.

xRangeMax double

X range end.

ignoreZeros bool

Ignore zeros.

Returns

bool

True if values were successfully detected.

GetMinMaxFromXRangeIgnoreValue(out double, out double, double, double, double)

This is similar to GetMinMaxFromXRange, but tailored for Series with DataBreaking. Get min and max Y value within given X range, but Ignore some values (gap defining value).

public override bool GetMinMaxFromXRangeIgnoreValue(out double yMin, out double yMax, double xRangeMin, double xRangeMax, double dIgnoreValue)

Parameters

yMin double

Minimum Y value.

yMax double

Maximum Y value.

xRangeMin double

X range start.

xRangeMax double

X range end.

dIgnoreValue double

Gap defining value.

Returns

bool

True if values were successfully detected.

GetXMinMax(out double, out double)

Get minimum X and maximum X of series X values.

public override bool GetXMinMax(out double xMin, out double xMax)

Parameters

xMin double

X minimum.

xMax double

X maximum.

Returns

bool

True if minimum X and maximum X was obtained successfully.

GetXValues()

Get X values array.

public double[] GetXValues()

Returns

double[]

X values array.

Remarks

This iterates through the Points list, making it slower than direct accessing with Points array. Note that the first array is not necessarily the first point of the series, as the Points array is a circular buffer.

GetYValues()

Get Y values array.

public double[] GetYValues()

Returns

double[]

Y values array.

Remarks

This iterates through the Points list, making it slower than direct accessing with Points array. Note that the first array is not necessarily the first point of the series, as the Points array is a circular buffer.

InvalidateData()

Invalidate data array. Statistics and draw data are recalculated.

public override void InvalidateData()

LoadFromCSV(string, SeparatorCSV)

Loads series data from a CSV file. Note that this loads points according to PointsType value. So if you need to load both, change PointsType accordingly between two calls to this method.

public override bool LoadFromCSV(string file, SeparatorCSV separator)

Parameters

file string

CSV file name. If file does not exist, LoadFromCSV returns false.

separator SeparatorCSV

Value and floating point number separator.

Returns

bool

True if import succeeds. Otherwise false.

OnDeserialized(StreamingContext)

OnDeserialized is called just after the object has been deserialized

[OnDeserialized]
protected void OnDeserialized(StreamingContext context)

Parameters

context StreamingContext

Context

SaveToCSV(string, SeparatorCSV)

Saves series data into CSV file. Note that this save points according to PointsType value. So if you need to save both, change PointsType accordingly between two calls to this method.

public override bool SaveToCSV(string file, SeparatorCSV separator)

Parameters

file string

Target file. If file already exists, it will be overwritten.

separator SeparatorCSV

Value and floating point number separator definition

Returns

bool

True if save is successful

SetXValue(int, double)

Set X value of Points array item.

public void SetXValue(int index, double xValue)

Parameters

index int

Point index in Points array.

xValue double

X value.

Remarks

Does not invalidate the data. Call InvalidateData() after you have set all values. Note that the first array is not necessarily the first point of the series, as the Points array is a circular buffer.

SetYValue(int, double)

Set Y value of Points array item.

public void SetYValue(int index, double yValue)

Parameters

index int

Point index in Points array.

yValue double

Y value.

Remarks

Does not invalidate the data. Call InvalidateData() after you have set all values. Note that the first array is not necessarily the first point of the series, as the Points array is a circular buffer.

SolveNearestDataPointByCoord(int, int, out double, out double, out int)

Solve nearest data point to given X and Y screen coordinate [input in DIP].

public bool SolveNearestDataPointByCoord(int xCoordinate, int yCoordinate, out double nearestPointXValue, out double nearestPointYValue, out int nearestIndex)

Parameters

xCoordinate int

X screen coordinate as DIP.

yCoordinate int

Y screen coordinate as DIP.

nearestPointXValue double

Nearest data point X.

nearestPointYValue double

Nearest data point Y.

nearestIndex int

Nearest data point index in the Points or PointsWithErrors array.

Returns

bool

True if successfully solved.

SolveNearestDataPointByValue(double, double, out double, out double, out int)

Solve nearest data point to given X and Y value.

public bool SolveNearestDataPointByValue(double xValue, double yValue, out double nearestPointXValue, out double nearestPointYValue, out int nearestIndex)

Parameters

xValue double

X value.

yValue double

Y value.

nearestPointXValue double

Nearest data point X.

nearestPointYValue double

Nearest data point Y.

nearestIndex int

Nearest data point index in the Points or PointsWithErrors array.

Returns

bool

True if successfully solved.

Remarks

The distance of given X and Y values and each data point is compared in screen coordinates.

SolveYCoordsAtXCoord(float, bool)

Find all instances of FreeformPointLineSeries’ intersection with vertical line going through the given X-coordinate. The intersection point is described by segment of line (pair of LineSeries’ points) it is found. Each intersection point is returned as LineSeriesCoordinateSolveResult structure, and method returns the list of those structures.

Note that you might be interested in using SolveNearestDataPointByCoord(int, int, out double, out double, out int) for some of the use cases.

X-coordinate in pixels or DIP.Use DIP instead of pixels as parameters.Iterable list of solve results.
public IList<LineSeriesCoordinateSolveResult> SolveYCoordsAtXCoord(float x, bool useDIP = false)

Parameters

x float
param x M:LightningChartLib.WinForms.Charting.SeriesXY.FreeformPointLineSeries.SolveYCoordsAtXCoord(System.Single,System.Boolean)
useDIP bool
param useDIP M:LightningChartLib.WinForms.Charting.SeriesXY.FreeformPointLineSeries.SolveYCoordsAtXCoord(System.Single,System.Boolean)

Returns

IList<LineSeriesCoordinateSolveResult>
returns M:LightningChartLib.WinForms.Charting.SeriesXY.FreeformPointLineSeries.SolveYCoordsAtXCoord(System.Single,System.Boolean)

Remarks

  -Parameters</strong></p><ul><li><span class="term">CoordBottom</span>Bottom-most Y-coordinate.</li><li><span class="term">CoordTop</span>Topmost Y-coordinate</li><li><span class="term">MinIndex</span>
Minimum index among the points related to hit.

<p>
Minimum index can be used for getting actual index of point related to hit from the original points array.
This might be useful in scenarios, where you want to first solve point from coordinate
by using this method and then get the actual value of that point.
</p></li><li><span class="term">NearestX</span>Nearest X-coordinate of actual data point among the points related to hit, calculated from given input X-coordinate.</li><li><span class="term">PointCount</span>Number of points directly related to hit.</li><li><span class="term">SolveStatus</span>Defines if points/hits were found for given X-coordinate or not.</li></ul>

SolveYValuesAtXValue(double)

Find all instances of FreeformPointLineSeries’ intersection with vertical line going through the given X-value. The intersection point is described by segment of line (pair of LineSeries’ points) it is found. Each intersection point is returned as LineSeriesValueSolveResult structure, and method returns the list of those structures.

Note that you might be interested in using SolveNearestDataPointByValue(double, double, out double, out double, out int) for some of the use cases.

X-value.Iterable list of solve results.
public IList<LineSeriesValueSolveResult> SolveYValuesAtXValue(double x)

Parameters

x double
param x M:LightningChartLib.WinForms.Charting.SeriesXY.FreeformPointLineSeries.SolveYValuesAtXValue(System.Double)

Returns

IList<LineSeriesValueSolveResult>
returns M:LightningChartLib.WinForms.Charting.SeriesXY.FreeformPointLineSeries.SolveYValuesAtXValue(System.Double)

Remarks

  -Parameters</strong></p><ul><li><span class="term">NearestDataPointIndex</span>Nearest data point index among points, calculated from given X-value.</li><li><span class="term">NearestX</span>Nearest X-value of actual data point among the points related to hit, calculated from given X-value.</li><li><span class="term">SolveStatus</span>Defines if points/hits were found for given X-value or not.</li><li><span class="term">YMax</span>Maximum Y-value for given X-value.</li><li><span class="term">YMin</span>Minimum Y-value for given X-value.</li></ul>