Options
All
  • Public
  • Public/Protected
  • All
Menu
summary

XyDataSeries is a DataSeries for holding X, Y data in SciChart's 2D JavaScript Charts

description

The XyDataSeries is primarily used with our JavaScript Line Chart, but can also be used by the JavaScript Scatter Chart or JavaScript Mountain/Area Chart and JavaScript Column Chart.

To instantiate an XyDataSeries, use the following code:

const xyDataSeries = new XyDataSeries(wasmContext);
xyDataSeries.append(1, 2); // Append a single x,y point
xyDataSeries.appendRange([3, 4], [3, 4]); // Append multiple x,y points (faster)
xyDataSeries.insert(0, 9, 10); // Insert a point at index 0
xyDataSeries.update(0, 11, 12); // Update a point at index 0
xyDataSeries.removeAt(0); // Remove a point at index 0
xyDataSeries.clear(); // Clear the dataseries
xyDataSeries.delete(); // Delete the dataseries and native (WebAssembly) memory
remarks

A DataSeries stores the data to render. This is independent from the RenderableSeries which defines how that data should be rendered.

See derived types of BaseDataSeries to find out what data-series are available. See derived types of IRenderableSeries to find out what 2D JavaScript Chart types are available.

Hierarchy

Implements

Index

Constructors

constructor

  • Creates an instance of XyDataSeries

    Parameters

    • webAssemblyContext: TSciChart

      the {@link TSciChart | SciChart WebAssembly Context} containing native methods and access to our underlying WebGL2 WebAssembly rendering engine

    • Optional options: IXyDataSeriesOptions

      the IXyDataSeriesOptions which can be passed to configure the DataSeries at construct time

    Returns XyDataSeries

Properties

Readonly dataChanged

dataChanged: EventHandler<void> = new EventHandler<void>()

An EventHandler which is raised when the data changes.

remarks

To subscribe to dataChanged, use the following code:

const dataSeries = new XyDataSeries(wasmContext);
const callback = () => {
   // Data has changed
};
dataSeries.dataChanged.subscribe(callback);

To unsubscribe from dataChanged, use the following code:

const dataSeries = new XyDataSeries(wasmContext);
dataSeries.dataChanged.unsubscribe(callback);

Protected indexes

indexes: DoubleVector

Protected isDeleted

isDeleted: boolean

minXSpacing

minXSpacing: number = 0

Readonly type

type: Xy = EDataSeriesType.Xy

Gets the EDataSeriesType type of the DataSeries

Protected webAssemblyContext

webAssemblyContext: TSciChart

The {@link TSciChart | SciChart WebAssembly Context} containing native methods and access to our WebGL2 Engine

Protected xValues

xValues: DoubleVector

Protected yValues

yValues: DoubleVector

Accessors

containsNaN

  • get containsNaN(): boolean
  • set containsNaN(containsNaN: boolean): void
  • Gets or sets whether the Y data contains NaN values. Set containsNaN = false for the performance optimization when the series has no NaNs

    inheritdoc

    Returns boolean

  • Gets or sets whether the Y data contains NaN values. Set containsNaN = false for the performance optimization when the series has no NaNs

    inheritdoc

    Parameters

    • containsNaN: boolean

    Returns void

dataSeriesName

  • get dataSeriesName(): string
  • set dataSeriesName(dataSeriesName: string): void
  • Gets the DataSeries name. This is used in legend controls and tooltips to identify the series

    inheritdoc

    Returns string

  • Gets the DataSeries name. This is used in legend controls and tooltips to identify the series

    inheritdoc

    Parameters

    • dataSeriesName: string

    Returns void

hasValues

  • get hasValues(): boolean
  • When true, the DataSeries has values, else it is empty

    inheritdoc

    Returns boolean

isSorted

  • get isSorted(): boolean
  • set isSorted(isSorted: boolean): void
  • Gets or sets whether the X-values are sorted or not. See remarks at IDataSeries.isSorted for further information

    inheritdoc

    Returns boolean

  • Gets or sets whether the X-values are sorted or not. See remarks at IDataSeries.isSorted for further information

    inheritdoc

    Parameters

    • isSorted: boolean

    Returns void

xRange

  • Gets the range in the X-direction for this DataSeries

    inheritdoc

    Returns NumberRange

Methods

append

  • append(x: number, y: number): void
  • Appends a single X, Y point to the DataSeries

    remarks

    For best performance on drawing large datasets, use the appendRange method

    Any changes of the DataSeries will trigger a redraw on the parent SciChartSurface

    Parameters

    • x: number

      The X-value

    • y: number

      The Y-value

    Returns void

appendRange

  • appendRange(xValues: number[], yValues: number[]): void
  • Appends a range of X, Y points to the DataSeries

    remarks

    This method is considerably higher performance than append which appends a single point

    Any changes of the DataSeries will trigger a redraw on the parent SciChartSurface

    Parameters

    • xValues: number[]

      The X-values

    • yValues: number[]

      The Y-values

    Returns void

clear

  • clear(): void
  • Clears the entire DataSeries.

    remarks

    Note this does not free memory, WebAssembly/Native memory is released by calling delete, after which the DataSeries is no longer usable.

    Any changes of the DataSeries will trigger a redraw on the parent SciChartSurface

    Returns void

count

  • count(): number
  • Gets the count of data-points in the DataSeries

    Returns number

delete

  • delete(): void
  • Deletes native (WebAssembly) memory used by this type, after which it cannot be used.

    remarks

    Call .delete() before finishing with the object to ensure that WebAssmembly memory leaks do not occur.

    All elements within SciChart's High Performance Realtime JavaScript Charts which implement IDeletable must be deleted manually to free native (WebAssembly) memory

    Returns void

getIndicesRange

getIsDeleted

  • getIsDeleted(): boolean

getNativeIndexes

  • getNativeIndexes(): DoubleVector

getNativeXValues

  • getNativeXValues(): DoubleVector

getNativeYValues

  • getNativeYValues(): DoubleVector

getWindowedYRange

insert

  • insert(startIndex: number, x: number, y: number): void
  • summary

    Inserts a single X,Y value at the start index

    remarks

    For best performance on drawing large datasets, use the insertRange method

    Any changes of the DataSeries will trigger a redraw on the parent SciChartSurface

    Parameters

    • startIndex: number

      the index to insert at

    • x: number

      the Xvalue

    • y: number

      the Yvalue

    Returns void

insertRange

  • insertRange(startIndex: number, xValues: number[], yValues: number[]): void
  • summary

    Inserts a range of X,Y values at the startIndex

    remarks

    Any changes of the DataSeries will trigger a redraw on the parent SciChartSurface

    Parameters

    • startIndex: number

      the index to insert at

    • xValues: number[]

      the XValues

    • yValues: number[]

      the YValues

    Returns void

notifyDataChanged

  • notifyDataChanged(): void

removeAt

  • removeAt(index: number): void
  • Removes an X,Y value at the specified index

    remarks

    Any changes of the DataSeries will trigger a redraw on the parent SciChartSurface

    Parameters

    • index: number

      the index to remove at

    Returns void

removeRange

  • removeRange(startIndex: number, count: number): void
  • summary

    Removes a range of X,Y values at the specified index

    remarks

    Any changes of the DataSeries will trigger a redraw on the parent SciChartSurface

    Parameters

    • startIndex: number

      the start index to remove at

    • count: number

      the number of points to remove

    Returns void

update

  • update(index: number, y: number): void
  • Updates a single Y-value by X-index

    remarks

    Any changes of the DataSeries will trigger a redraw on the parent SciChartSurface

    Parameters

    • index: number

      the index to update

    • y: number

      The new Y value

    Returns void

Generated using TypeDoc