Class SampleDataSeries
- Namespace
- LightningChartLib.WinForms.Charting.SeriesXY
- Assembly
- LightningChart.WinForms.Charting.NET4.dll
Sample data series class.
public class SampleDataSeries : ProgressiveSingleLineSeriesBase, IChartNode, IDisposable, IHighlightingItem, ISingleLineSeriesSolveResultReturningSeries, ITrackable, ILevelTriggable, IRealtimeShiftable
- Inheritance
-
SampleDataSeries
- Implements
- Inherited Members
Constructors
SampleDataSeries()
Constructor for Form designer list editor.
public SampleDataSeries()
SampleDataSeries(ViewXY, AxisX, AxisY)
Constructor
public SampleDataSeries(ViewXY owner, AxisX axisX, AxisY axisY)
Parameters
Properties
CursorTrackEnabled
Cursor tracking enabled.
public bool CursorTrackEnabled { get; set; }
Property Value
FirstSampleTimeStamp
First sample time stamp, usually 1/SamplingFrequency
public double FirstSampleTimeStamp { get; set; }
Property Value
SampleFormat
Sample format
public SampleFormat SampleFormat { get; set; }
Property Value
SamplesDouble
Series samples, Double format
public double[] SamplesDouble { get; set; }
Property Value
- double[]
Exceptions
- ChartException
Thrown when trying to set samples that are not compatible with chosen SampleFormat.
SamplesSingle
Series samples, Single format
public float[] SamplesSingle { get; set; }
Property Value
- float[]
Exceptions
- ChartException
Thrown when trying to set samples that are not compatible with chosen SampleFormat.
SamplingFrequency
Sampling frequency, in Hz. (sample interval is 1/SamplingFrequency)
public double SamplingFrequency { get; set; }
Property Value
ScrollModePointsKeepLevel
Tells how often the draw data is cleared when using X axis scroll mode. Valid range is 1...100 1 frees the draw data and the reconstructs the draw data after every 1/10 scroll page. Use this when there's not much memory available. 100 frees the draw data and the reconstructs the draw data after every 100/10 = 10 pages. Use this when smooth scroll with high FPS is important. Reserves some extra memory.
public int ScrollModePointsKeepLevel { get; set; }
Property Value
ScrollingStabilizing
Stabilize scrolling mode by rounding shifting to nearest integer pixel position.
Reduces wobbling of the scrolling waveform, but may show as slight X-dimensional distortion.
public bool ScrollingStabilizing { get; set; }
Property Value
Methods
AddOffsetToSamples(double)
Adds offset to all samples (Increments all samples by given value).
public void AddOffsetToSamples(double offset)
Parameters
offsetdoubleOffset.
AddSamples(double[], bool)
Add samples to end of series, double format.
public int AddSamples(double[] samples, bool invalidateChart)
Parameters
samplesdouble[]Samples array
invalidateChartboolUpdate chart after adding. Updating will raise CPU load, which is why usage of this method is not recommended with every call if points are added many times per second.
Returns
- int
Series sample count after adding.
AddSamples(float[], bool)
Add samples to end of series, float format.
public int AddSamples(float[] samples, bool invalidateChart)
Parameters
samplesfloat[]Samples array.
invalidateChartboolUpdate chart after adding samples. Updating will raise CPU load, which is why usage of this method is not recommended with every call if points are added many times per second.
Returns
- int
Series sample count after adding.
Clear()
Clear all samples.
public override void Clear()
Construct()
Create members.
protected override void Construct()
DeleteSamplesBeforeX(double, bool)
Delete samples having smaller X value than given value.
public void DeleteSamplesBeforeX(double xValue, bool compactMemory = true)
Parameters
Dispose(bool)
Clean up any resources being used.
protected override void Dispose(bool disposing)
Parameters
disposingbooltrue if managed resources should be disposed, otherwise false.
GetMinMaxFromXRange(out double, out double, double, double, bool)
Get minimum and maximum Y value withing 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 minimum and maximum 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.
LoadFromCSV(string, SeparatorCSV)
Loads series data from a CSV file.
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.
MultiplySamples(double)
Multiplies the samples in the samples array with given factor.
public void MultiplySamples(double factor)
Parameters
factordoubleFactor.
SaveToCSV(string, SeparatorCSV)
Saves sample data into CSV file.
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
SeekTriggerPos(out double, double, double, double, TriggeringEdge)
Detect triggering position from series data.
public bool SeekTriggerPos(out double trigPosX, double trigLevel, double seekStartX, double seekEndX, TriggeringEdge edge)
Parameters
trigPosXdoubleOutput triggered X position.
trigLeveldoubleTrigger level Y value.
seekStartXdoubleMinimum X value that is investigated.
seekEndXdoubleMaximum X value that is investigated.
edgeTriggeringEdgeTriggering edge.
Returns
- bool
True if trigger position was detected, otherwise false.
SeekVisibleRangeStartPointIndex(double)
Seek visible range first series point index (actually one point before that)
protected int SeekVisibleRangeStartPointIndex(double startXValue)
Parameters
startXValuedoubleStart x value
Returns
- int
Start point index. If unable to find start point, returns -1
Remarks
Always make sure m_points are locked before calling this method
SolveNearestSampleByCoord(int, int, out double, out double, out int)
Solve nearest sample to given X and Y screen coordinate [in DIPs].
public bool SolveNearestSampleByCoord(int xCoordinate, int yCoordinate, out double nearestSampleXValue, out double nearestSampleYValue, out int nearestIndex)
Parameters
xCoordinateintX screen coordinate [in DIPs].
yCoordinateintY screen coordinate [in DIPs].
nearestSampleXValuedoubleNearest sample X.
nearestSampleYValuedoubleNearest sample Y.
nearestIndexintNearest sample index in the SampleSingle or SamplesDouble array.
Returns
- bool
True if successfully solved.
SolveNearestSampleByValue(double, double, out double, out double, out int)
Solve nearest sample to given X and Y value.
public bool SolveNearestSampleByValue(double xValue, double yValue, out double nearestSampleXValue, out double nearestSampleYValue, out int nearestIndex)
Parameters
xValuedoubleX value.
yValuedoubleY value.
nearestSampleXValuedoubleNearest sample X.
nearestSampleYValuedoubleNearest sample Y.
nearestIndexintNearest sample index in the SampleSingle or SamplesDouble array.
Returns
- bool
True if successfully solved.
Remarks
The distance of given X and Y values and each sample is compared in screen coordinates.
SolveYValueAtXValue(double)
Solve Y value on given X value. Returned value will be interpolated, if X is between sequential points X values.
public override LineSeriesValueSolveResult SolveYValueAtXValue(double x)
Parameters
xdoubleX value.
Returns
- LineSeriesValueSolveResult
Solve status. NearestX will be double.NaN if point is not in the data range.
Events
OldDataDropped
Occurs when old data samples have been dropped.
public event SampleDataSeries.OldDataDroppedEventHandler OldDataDropped