Table of Contents

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

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

FirstSampleTimeStamp

First sample time stamp, usually 1/SamplingFrequency

public double FirstSampleTimeStamp { get; set; }

Property Value

double

SampleFormat

Sample format

public SampleFormat SampleFormat { get; set; }

Property Value

SampleFormat

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

double

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

int

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. Only applies when XAxis ScrollMode = ScrollingScrollMode

public bool ScrollingStabilizing { get; set; }

Property Value

bool

Methods

AddOffsetToSamples(double)

Adds offset to all samples (Increments all samples by given value).

public void AddOffsetToSamples(double offset)

Parameters

offset double

Offset.

AddSamples(double[], bool)

Add samples to end of series, double format.

public int AddSamples(double[] samples, bool invalidateChart)

Parameters

samples double[]

Samples array

invalidateChart bool

Update 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

samples float[]

Samples array.

invalidateChart bool

Update 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

xValue double

X value.

compactMemory bool

Compact memory.

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.

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

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 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

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.

LoadFromCSV(string, SeparatorCSV)

Loads series data from a CSV file.

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.

MultiplySamples(double)

Multiplies the samples in the samples array with given factor.

public void MultiplySamples(double factor)

Parameters

factor double

Factor.

SaveToCSV(string, SeparatorCSV)

Saves sample data into CSV file.

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

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

trigPosX double

Output triggered X position.

trigLevel double

Trigger level Y value.

seekStartX double

Minimum X value that is investigated.

seekEndX double

Maximum X value that is investigated.

edge TriggeringEdge

Triggering 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

startXValue double

Start 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

xCoordinate int

X screen coordinate [in DIPs].

yCoordinate int

Y screen coordinate [in DIPs].

nearestSampleXValue double

Nearest sample X.

nearestSampleYValue double

Nearest sample Y.

nearestIndex int

Nearest 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

xValue double

X value.

yValue double

Y value.

nearestSampleXValue double

Nearest sample X.

nearestSampleYValue double

Nearest sample Y.

nearestIndex int

Nearest 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

x double

X 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

Event Type

SampleDataSeries.OldDataDroppedEventHandler