DataSeries

StockSharp.Xaml.Charting.Model.DataSeries

A generic abstract base class which defines a generic DataSeries which contains 1..N columns, such as X,Y in the case of plain X,Y data, or X, Open, High, Low, Close in the case of OHLC data.

Inherits: BindableObject

Implements: IDataSeries<T, T>, IDataSeries, ISuspendable

Constructors

DataSeries
protected DataSeries()
dataSeries = DataSeries()

Initializes a new instance of the DataSeries class.

Properties

AcceptsUnsortedData
public bool AcceptsUnsortedData { get; set; }
value = dataSeries.AcceptsUnsortedData
dataSeries.AcceptsUnsortedData = value

New to v3.3: when AcceptsUnsortedData is false, the DataSeries with throw an InvalidOperationException if unsorted data is appended. Unintentional unsorted data can result in much slower performance. To disable this check, set AcceptsUnsortedData = true.

Count
public int Count { get; }
value = dataSeries.Count

Gets the number of points in this data series

DataDistributionCalculator
public IDataDistributionCalculator<TX> DataDistributionCalculator { get; set; }
value = dataSeries.DataDistributionCalculator
dataSeries.DataDistributionCalculator = value

Gets or Sets the DataDistrutionCalculator instance for this DataSeries. Used when resampling data to determine the correct algorithm

DataSeriesType
public abstract DataSeriesType DataSeriesType { get; }
value = dataSeries.DataSeriesType

Gets the DataSeriesType for this DataSeries

FifoCapacity
public int? FifoCapacity { get; set; }
value = dataSeries.FifoCapacity
dataSeries.FifoCapacity = value

Gets or sets the size of the FIFO buffer. If null, then the dataseries is unlimited. If a value is set, when the point count reaches this value, older points will be discarded

HasValues
public abstract bool HasValues { get; }
value = dataSeries.HasValues

Gets whether the Data Series has values (is not empty)

IsAttached
public bool IsAttached { get; }
value = dataSeries.IsAttached

Gets a value indicating whether this instance is attached.

IsFifo
public bool IsFifo { get; }
value = dataSeries.IsFifo

Gets whether the dataseries behaves as a FIFO If True, when the FifoCapacity is reached, old points will be discarded in favour of new points

IsSecondary
public virtual bool IsSecondary { get; set; }
value = dataSeries.IsSecondary
dataSeries.IsSecondary = value

If true, this data series will not be selected for chart range calculation.

IsSorted
public bool IsSorted { get; }
value = dataSeries.IsSorted

Gets whether this DataSeries contains Sorted data in the X-direction. Note: Sorted data will result in far faster indexing operations. If at all possible, try to keep your data sorted in the X-direction

IsSuspended
public bool IsSuspended { get; }
value = dataSeries.IsSuspended

Gets a value indicating whether updates for the target are currently suspended

Item
public TY Item { get; }
value = dataSeries.Item

Gets the item at the index from the specified DataSeriesColumn.

LatestYValue
public IComparable LatestYValue { get; }
value = dataSeries.LatestYValue

Gets the latest Y-Value of the DataSeries

ParentSurface
public IUltrachartSurface ParentSurface { get; set; }
value = dataSeries.ParentSurface
dataSeries.ParentSurface = value

Gets or sets the parent IUltrachartSurface which this IDataSeries instance is attached to

SeriesName
public string SeriesName { get; set; }
value = dataSeries.SeriesName
dataSeries.SeriesName = value

Gets or sets the name of this series

SyncRoot
public Lock SyncRoot { get; }
value = dataSeries.SyncRoot

Synchronization object (per instance)

XMax
public IComparable XMax { get; }
value = dataSeries.XMax

Gets the computed Maximum value in X for this series

XMin
public IComparable XMin { get; }
value = dataSeries.XMin

Gets the computed Minimum value in X for this series

XRange
public virtual IRange XRange { get; }
value = dataSeries.XRange

Gets the computed XRange, which is an IRange wrapping XMin and XMax properties

XType
public Type XType { get; }
value = dataSeries.XType

Gets the Type of X-data points in this DataSeries. Used to check compatibility with Axis types

XValues
public IList<TX> XValues { get; }
value = dataSeries.XValues

Gets the X Values of this series

YMax
public IComparable YMax { get; }
value = dataSeries.YMax

Gets the computed Maximum value in Y for this series

YMin
public IComparable YMin { get; }
value = dataSeries.YMin

Gets the computed Minimum value in Y for this series

YRange
public virtual IRange YRange { get; }
value = dataSeries.YRange

Gets the computed YRange, which is an IRange wrapping YMin and YMax properties

YType
public Type YType { get; }
value = dataSeries.YType

Gets the Type of Y-data points in this DataSeries. Used to check compatibility with Axis types

YValues
public IList<TY> YValues { get; }
value = dataSeries.YValues

Gets the Y Values of this series

Methods

Append
public abstract void Append(IEnumerable<TX> x, IEnumerable<TY>[] yValues)
dataSeries.Append(x, yValues)

Appends a list of X, Y points to the series

x
The list of X points
yValues
Lists of Y points (depends on series type)
Append
public abstract void Append(TX x, TY[] yValues)
dataSeries.Append(x, yValues)

Appends an X, Y point to the series

x
The X Value
yValues
The Y Values (depends on series type)
Clear
public void Clear()
dataSeries.Clear()

Clears the series, resetting internal lists to zero size

ClearColumns
protected abstract void ClearColumns()
dataSeries.ClearColumns()

When overridden in a derived class, clears all columns in the Data Series

Clone
public abstract IDataSeries<TX, TY> Clone()
result = dataSeries.Clone()

Creates a deep copy of a DataSeries

DecrementSuspend
public void DecrementSuspend()
dataSeries.DecrementSuspend()

Called by IUpdateSuspender each time a target suspender is disposed. When the final target suspender has been disposed, ResumeUpdates is called

FindClosestLine
public virtual int FindClosestLine(IComparable x, IComparable y, double xyScaleRatio, double xRadius, LineDrawMode drawNanAs)
result = dataSeries.FindClosestLine(x, y, xyScaleRatio, xRadius, drawNanAs)

Finds the closest line to a point with given X and Y value. Search region is a vertical area with center in X and [maxXDistance] X units to left and right

x
The X-value of point [X data units, not pixels]
y
The Y-value of point [Y data units, not pixels]
xyScaleRatio
xUnitsPerPixel/yUnitsPerPixel
xRadius
specifies search region in X units (ticks for DateTime or TimeSpan)
drawNanAs
specifies how to handle NAN elements

Returns: The index of first point in line, -1 if not found (when count is zero)

FindClosestPoint
public virtual int FindClosestPoint(IComparable xValue, IComparable yValue, double xyScaleRatio, double hitTestRadius)
result = dataSeries.FindClosestPoint(xValue, yValue, xyScaleRatio, hitTestRadius)

Finds the closest point to a point with given X and Y value. Search region is a vertical area with center in X and [maxXDistance] X units to left and right

xValue
The X-value of point [X data units, not pixels]
yValue
The Y-value of point [Y data units, not pixels]
xyScaleRatio
xUnitsPerPixel/yUnitsPerPixel
hitTestRadius
Specifies search region in chart coordinates(ticks for DateTime or TimeSpan)

Returns: The index of the found value, -1 if not found (when count is zero)

FindIndex
public int FindIndex(IComparable x, SearchMode searchMode)
result = dataSeries.FindIndex(x, searchMode)

Finds the index to the DataSeries at the specified X-Value

x
The X-value to search for
searchMode
The SearchMode options to use. Default is exact, where -1 is returned if the index is not found

Returns: The index of the found value

GetIndicesRange
public IndexRange GetIndicesRange(IRange range)
result = dataSeries.GetIndicesRange(range)

Gets the integer indices of the XValues array that are currently in the VisibleRange passed in.

range
The VisibleRange to get the indices range

Returns: The indices to the X-Data that are currently in range

GetPositiveMin``1
protected T GetPositiveMin<T>(T positiveMin, T min)
result = dataSeries.GetPositiveMin(positiveMin, min)

Gets the minimum positive value of (positiveMin, min)

positiveMin
min
GetWindowedYRange
public IRange GetWindowedYRange(IRange xRange, bool getPositiveRange)
result = dataSeries.GetWindowedYRange(xRange, getPositiveRange)

Gets the YRange of the data (min, max of the series) in the input visible range point range, where the input range is the VisibleRange

xRange
The X-Axis Range currently in view
getPositiveRange
Indicates whether to return positive YRange only

Returns: The YRange of the data in this window

GetWindowedYRange
public IRange GetWindowedYRange(IndexRange xIndexRange)
result = dataSeries.GetWindowedYRange(xIndexRange)

Gets the YRange of the data (min, max of the series) in the input IndexRange, where indices are point-indices on the DataSeries columns

xIndexRange
The X-Axis Indices currently in view

Returns: The YRange of the data in this window

GetWindowedYRange
public IRange GetWindowedYRange(IRange xRange)
result = dataSeries.GetWindowedYRange(xRange)

Gets the YRange of the data (min, max of the series) in the input visible range point range, where the input range is the VisibleRange

xRange
The X-Axis Range currently in view

Returns: The YRange of the data in this window

GetWindowedYRange
public IRange GetWindowedYRange(IndexRange xIndexRange, bool getPositiveRange)
result = dataSeries.GetWindowedYRange(xIndexRange, getPositiveRange)

Gets the YRange of the data (min, max of the series) in the input IndexRange, where indices are point-indices on the DataSeries columns

xIndexRange
The X-Axis Indices currently in view
getPositiveRange
Indicates whether to return positive YRange only

Returns: The YRange of the data in this window

GetXMinAt
public TX GetXMinAt(int index, TX existingXMin)
result = dataSeries.GetXMinAt(index, existingXMin)

When overriden in a derived class, gets the Min(existingXMin, currentMin), where currentMin is the minimum at the specified index

index
The index to the underlying dataset
existingXMin
The existing minimum

Returns: The new XMin, which is the Min(existingXMin, currentMin)

GetYMaxAt
public abstract TY GetYMaxAt(int index, TY existingYMax)
result = dataSeries.GetYMaxAt(index, existingYMax)

When overriden in a derived class, gets the Max(existingYMax, currentMax), where currentMax is the maximum at the specified index

index
The index to the underlying dataset
existingYMax
The existing maximum

Returns: The new YMax, which is the Min(existingYMax, currentMax)

GetYMinAt
public abstract TY GetYMinAt(int index, TY existingYMin)
result = dataSeries.GetYMinAt(index, existingYMin)

When overriden in a derived class, gets the Min(existingYMin, currentMin), where currentMin is the minimum at the specified index

index
The index to the underlying dataset
existingYMin
The existing minimum

Returns: The new YMin, which is the Min(existingYMin, currentMin)

InvalidateParentSurface
public void InvalidateParentSurface(RangeMode rangeMode)
dataSeries.InvalidateParentSurface(rangeMode)

May be called to trigger a redraw on the parent UltrachartSurface. This method is extremely useful when IDataSeries are in a ViewModel and bound via MVVM to IRenderableSeries. Please see the parameter for invalidation options

rangeMode
Provides RangeMode invalidation options for the parent surface
Remove
public void Remove(TX x)
dataSeries.Remove(x)

Removes the associated Y-Values for the specified X-Value

x
The X DataValue to remove. Removes all associated Y-Values
RemoveAt
public abstract void RemoveAt(int index)
dataSeries.RemoveAt(index)

Removes the X,Y values at the specified index

index
The index to remove at
RemoveRange
public abstract void RemoveRange(int startIndex, int count)
dataSeries.RemoveRange(startIndex, count)

Removes a range of points starting from the specified index

startIndex
Starting index of the range of elements to remove
count
The number of elements to remove
ResumeUpdates
public void ResumeUpdates(IUpdateSuspender suspender)
dataSeries.ResumeUpdates(suspender)

Resumes updates on the target, intended to be called by IUpdateSuspender

suspender
SuspendUpdates
public IUpdateSuspender SuspendUpdates()
result = dataSeries.SuspendUpdates()

Suspends drawing updates on the target until the returned object is disposed, when a final draw call will be issued

Returns: The disposable Update Suspender

ThrowWhenAppendInvalid
protected void ThrowWhenAppendInvalid(int paramsCount)
dataSeries.ThrowWhenAppendInvalid(paramsCount)

Asserts correct number of parameters supplied to Append(TX, params TY) and throws if necessary

paramsCount
The expected params count
ToHitTestInfo
public virtual HitTestInfo ToHitTestInfo(int index)
result = dataSeries.ToHitTestInfo(index)

When overridden in a derived class, returns a HitTestInfo struct containing data about the data-point at the specified index

index
The index to the DataSeries

Returns: The HitTestInfo

ToPointSeries
public abstract IPointSeries ToPointSeries(ResamplingMode resamplingMode, IndexRange pointRange, int viewportWidth, bool isCategoryAxis, bool? dataIsDisplayedAs2D, IRange visibleXRange, IPointResamplerFactory factory, object pointSeriesArg)
result = dataSeries.ToPointSeries(resamplingMode, pointRange, viewportWidth, isCategoryAxis, dataIsDisplayedAs2D, visibleXRange, factory, pointSeriesArg)

Converts the default YValues to an IPointSeries which is used to render XY series

resamplingMode
The desired ResamplingMode
pointRange
The integer Indices range in the parent data-set
viewportWidth
The current width of the viewport
isCategoryAxis
If true, uses the indices to form the resampled X-values, else uses the X-Values themselves
dataIsDisplayedAs2D
If true, then data is considered as a scatter series without relationship between the points, e.g. not a line series
visibleXRange
factory
The PointResamplerFactory which returns IPointResampler instances
pointSeriesArg
Additional parameter to the point series.

Returns: A IPointSeries which is used to render XY series

ToPointSeries
public IPointSeries ToPointSeries(IList column, ResamplingMode resamplingMode, IndexRange pointRange, int viewportWidth, bool isCategoryAxis)
result = dataSeries.ToPointSeries(column, resamplingMode, pointRange, viewportWidth, isCategoryAxis)

OBSOLETE. Use ToPointSeries instead, and cast to correct type of point series

column
resamplingMode
pointRange
viewportWidth
isCategoryAxis

Events

DataSeriesChanged
public event EventHandler<DataSeriesChangedEventArgs> DataSeriesChanged
dataSeries.DataSeriesChanged += handler

Event raised whenever points are added to, removed or one or more DataSeries properties changes

Fields

_xColumn
protected ISeriesColumn<TX> _xColumn
value = dataSeries._xColumn

The XColumn for this DataSeries

_yColumn
protected ISeriesColumn<TY> _yColumn
value = dataSeries._yColumn

The primary YColumn for this DataSeries