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
Properties
CursorTrackEnabled
Cursor tracking enabled.
public bool CursorTrackEnabled { get; set; }
Property Value
ErrorBars
Error bars.
public ErrorBarSettings ErrorBars { get; set; }
Property Value
IndividualPointColoring
Selects how to use the individual point colors. Sets which PointStyle color is replaced with PointColor.
public PointColoringTarget IndividualPointColoring { get; set; }
Property Value
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
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
PointCountLimitEnabled
Limit point count by dropping oldest points. The point count is limited to PointCountLimit.
public bool PointCountLimitEnabled { get; set; }
Property Value
Points
Series points
public SeriesPoint[] Points { get; set; }
Property Value
PointsType
Points type
public PointsType PointsType { get; set; }
Property Value
PointsWithErrors
Series points with error tolerance indicators
public SeriesErrorPoint[] PointsWithErrors { get; set; }
Property Value
Methods
AddPoints(SeriesErrorPoint[], bool)
Add points with error tolerance to end of series.
public int AddPoints(SeriesErrorPoint[] points, bool invalidateChart)
Parameters
pointsSeriesErrorPoint[]Points.
invalidateChartboolUpdate 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
pointsSeriesPoint[]Points.
invalidateChartboolUpdate 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
xValuesdouble[]X values.
yValuesdouble[]Y values.
invalidateChartboolUpdate 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
disposingbooltrue 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
yMindoubleMinimum Y value.
yMaxdoubleMaximum Y value.
xRangeMindoubleX range start.
xRangeMaxdoubleX range end.
ignoreZerosboolIgnore 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
yMindoubleMinimum Y value.
yMaxdoubleMaximum Y value.
xRangeMindoubleX range start.
xRangeMaxdoubleX range end.
dIgnoreValuedoubleGap 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
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
filestringCSV file name. If file does not exist, LoadFromCSV returns false.
separatorSeparatorCSVValue 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
contextStreamingContextContext
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
filestringTarget file. If file already exists, it will be overwritten.
separatorSeparatorCSVValue 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
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
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
xCoordinateintX screen coordinate as DIP.
yCoordinateintY screen coordinate as DIP.
nearestPointXValuedoubleNearest data point X.
nearestPointYValuedoubleNearest data point Y.
nearestIndexintNearest 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
xValuedoubleX value.
yValuedoubleY value.
nearestPointXValuedoubleNearest data point X.
nearestPointYValuedoubleNearest data point Y.
nearestIndexintNearest 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.public IList<LineSeriesCoordinateSolveResult> SolveYCoordsAtXCoord(float x, bool useDIP = false)
Parameters
xfloatparam x M:LightningChartLib.WinForms.Charting.SeriesXY.FreeformPointLineSeries.SolveYCoordsAtXCoord(System.Single,System.Boolean) useDIPboolparam 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.public IList<LineSeriesValueSolveResult> SolveYValuesAtXValue(double x)
Parameters
xdoubleparam 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>