Table of Contents

Class SampleDataBlockSeries

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

Block sample data series class. Can be only used with Linear axis and DirectX11 engine.

public class SampleDataBlockSeries : BlockSeriesBase<float[]>, IChartNode, IDisposable, IHighlightingItem, ILevelTriggable, ISingleLineSeriesSolveResultReturningSeries, IRealtimeShiftable, ITrackable
Inheritance
SampleDataBlockSeries
Implements
Inherited Members

Constructors

SampleDataBlockSeries()

Constructor.

public SampleDataBlockSeries()

SampleDataBlockSeries(ViewXY, AxisX, AxisY)

Constructor.

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

Parameters

owner ViewXY
param owner M:LightningChartLib.WinForms.Charting.SeriesXY.SampleDataBlockSeries.#ctor(LightningChartLib.WinForms.Charting.Views.ViewXY.ViewXY,LightningChartLib.WinForms.Charting.Axes.AxisX,LightningChartLib.WinForms.Charting.Axes.AxisY)
axisX AxisX
param axisX M:LightningChartLib.WinForms.Charting.SeriesXY.SampleDataBlockSeries.#ctor(LightningChartLib.WinForms.Charting.Views.ViewXY.ViewXY,LightningChartLib.WinForms.Charting.Axes.AxisX,LightningChartLib.WinForms.Charting.Axes.AxisY)
axisY AxisY
param axisY M:LightningChartLib.WinForms.Charting.SeriesXY.SampleDataBlockSeries.#ctor(LightningChartLib.WinForms.Charting.Views.ViewXY.ViewXY,LightningChartLib.WinForms.Charting.Axes.AxisX,LightningChartLib.WinForms.Charting.Axes.AxisY)

Properties

FirstSampleTimeStamp

First sample time stamp, usually 1/SamplingFrequency.

public double FirstSampleTimeStamp { get; set; }

Property Value

double

this[int]

Get point at index.

public PointDouble2D this[int index] { get; }

Parameters

index int

Index to data.

Property Value

PointDouble2D

Data point at index.

LimitYToStackSegment

Line rendering limit on y-axis.

public LimitYToSegment LimitYToStackSegment { get; set; }

Property Value

LimitYToSegment

PointCount

Added sample count.

public int PointCount { get; }

Property Value

int

Samples

Series samples.

public float[][] Samples { set; }

Property Value

float[][]

SamplingFrequency

Sampling frequency, in Hz. (sample interval is 1/SamplingFrequency).

public double SamplingFrequency { get; set; }

Property Value

double

Methods

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.

Construct()

Create members.

protected override void Construct()

DeleteSamplesBeforeX(double, bool)

Delete all blocks where the last point in the block has smaller X value than the given value. Note, the block is formed when AddPoints method is called.

public void DeleteSamplesBeforeX(double xValue, bool compactMemory = true)

Parameters

xValue double

X value.

compactMemory bool

Compact memory.

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

GetSampleAtIndex(int)

Get sample at index.

public float GetSampleAtIndex(int index)

Parameters

index int

Sample index for whole data.

Returns

float

Y-value at index

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.

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.

SolveNearestSampleByValue(double, double, out double, out double, out int)

Solve nearest sample to given X and Y value.

public override 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.

SolveYCoordAtXCoord(float, bool)

Find nearest series point of given X-coordinate and get corresponding Y-coordinate.

public LineSeriesCoordinateSolveResult SolveYCoordAtXCoord(float x, bool useDIP = false)

Parameters

x float

X-coordinate in pixels or DIP.

useDIP bool

Use DIP instead of pixels as parameters.

Returns

LineSeriesCoordinateSolveResult

Solve result.

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 SampleDataBlockSeries.OldDataDroppedEventHandler OldDataDropped

Event Type

SampleDataBlockSeries.OldDataDroppedEventHandler