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
protected DataSeries()
dataSeries = DataSeries()
Initializes a new instance of the DataSeries class.
Properties
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.
public int Count { get; }
value = dataSeries.Count
Gets the number of points in this data series
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
public abstract DataSeriesType DataSeriesType { get; }
value = dataSeries.DataSeriesType
Gets the DataSeriesType for this DataSeries
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
public abstract bool HasValues { get; }
value = dataSeries.HasValues
Gets whether the Data Series has values (is not empty)
public bool IsAttached { get; }
value = dataSeries.IsAttached
Gets a value indicating whether this instance is attached.
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
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.
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
public bool IsSuspended { get; }
value = dataSeries.IsSuspended
Gets a value indicating whether updates for the target are currently suspended
public TY Item { get; }
value = dataSeries.Item
Gets the item at the index from the specified DataSeriesColumn.
public IComparable LatestYValue { get; }
value = dataSeries.LatestYValue
Gets the latest Y-Value of the DataSeries
public IUltrachartSurface ParentSurface { get; set; }
value = dataSeries.ParentSurface
dataSeries.ParentSurface = value
Gets or sets the parent IUltrachartSurface which this IDataSeries instance is attached to
public string SeriesName { get; set; }
value = dataSeries.SeriesName
dataSeries.SeriesName = value
Gets or sets the name of this series
StockSharp#Xaml#Charting#Model#DataSeries#IDataSeries#XValues
Gets the X Values of this dataseries
StockSharp#Xaml#Charting#Model#DataSeries#IDataSeries#YValues
Gets the Y Values of this dataseries
public Lock SyncRoot { get; }
value = dataSeries.SyncRoot
Synchronization object (per instance)
public IComparable XMax { get; }
value = dataSeries.XMax
Gets the computed Maximum value in X for this series
public IComparable XMin { get; }
value = dataSeries.XMin
Gets the computed Minimum value in X for this series
public virtual IRange XRange { get; }
value = dataSeries.XRange
Gets the computed XRange, which is an IRange wrapping XMin and XMax properties
public Type XType { get; }
value = dataSeries.XType
Gets the Type of X-data points in this DataSeries. Used to check compatibility with Axis types
public IList<TX> XValues { get; }
value = dataSeries.XValues
Gets the X Values of this series
public IComparable YMax { get; }
value = dataSeries.YMax
Gets the computed Maximum value in Y for this series
public IComparable YMin { get; }
value = dataSeries.YMin
Gets the computed Minimum value in Y for this series
public virtual IRange YRange { get; }
value = dataSeries.YRange
Gets the computed YRange, which is an IRange wrapping YMin and YMax properties
public Type YType { get; }
value = dataSeries.YType
Gets the Type of Y-data points in this DataSeries. Used to check compatibility with Axis types
public IList<TY> YValues { get; }
value = dataSeries.YValues
Gets the Y Values of this series
Methods
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)
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)
public void Clear()
dataSeries.Clear()
Clears the series, resetting internal lists to zero size
protected abstract void ClearColumns()
dataSeries.ClearColumns()
When overridden in a derived class, clears all columns in the Data Series
public abstract IDataSeries<TX, TY> Clone()
result = dataSeries.Clone()
Creates a deep copy of a DataSeries
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
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)
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)
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
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
protected T GetPositiveMin<T>(T positiveMin, T min)
result = dataSeries.GetPositiveMin(positiveMin, min)
Gets the minimum positive value of (positiveMin, min)
- positiveMin
- min
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
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
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
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
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)
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)
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)
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
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
public abstract void RemoveAt(int index)
dataSeries.RemoveAt(index)
Removes the X,Y values at the specified index
- index
- The index to remove at
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
public void ResumeUpdates(IUpdateSuspender suspender)
dataSeries.ResumeUpdates(suspender)
Resumes updates on the target, intended to be called by IUpdateSuspender
- suspender
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
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
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
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
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
public event EventHandler<DataSeriesChangedEventArgs> DataSeriesChanged
dataSeries.DataSeriesChanged += handler
Event raised whenever points are added to, removed or one or more DataSeries properties changes
Fields
protected ISeriesColumn<TX> _xColumn
value = dataSeries._xColumn
The XColumn for this DataSeries
protected ISeriesColumn<TY> _yColumn
value = dataSeries._yColumn
The primary YColumn for this DataSeries