UNPKG

scichart

Version:

Fast WebGL JavaScript Charting Library and Framework

167 lines (166 loc) 8.54 kB
import { NumberRange } from "../../Core/NumberRange"; import { NumberArray } from "../../types/NumberArray"; import { SCRTDoubleVector, TSciChart } from "../../types/TSciChart"; import { EYRangeMode } from "../../types/YRangeMode"; import { BaseDataSeries, IBaseDataSeriesOptions } from "./BaseDataSeries"; import { EDataSeriesType, EDataSeriesValueType } from "./IDataSeries"; import { IPointMetadata } from "./IPointMetadata"; /** * Options to pass to the {@link OhlcDataSeries} constructor */ export interface IOhlcDataSeriesOptions extends IBaseDataSeriesOptions { /** * The X-values array to pre-populate the {@link OhlcDataSeries} */ xValues?: NumberArray; /** * The Open-values array to pre-populate the {@link OhlcDataSeries} */ openValues?: NumberArray; /** * The High-values array to pre-populate the {@link OhlcDataSeries} */ highValues?: NumberArray; /** * The Low-values array to pre-populate the {@link OhlcDataSeries} */ lowValues?: NumberArray; /** * The Close-values array to pre-populate the {@link OhlcDataSeries} */ closeValues?: NumberArray; } /** * OhlcDataSeries is a DataSeries for holding Open, High, Low, Close data in SciChart's * {@link https://www.scichart.com/javascript-chart-features | JavaScript Stock Charts} * @remarks * The OhlcDataSeries is primarily used with the {@link FastCandlestickRenderableSeries | JavaScript Candlestick Chart} * but can also be used with our {@link FastOhlcRenderableSeries | JavaScript Ohlc Chart}, * used for drawing {@link https://www.scichart.com/javascript-chart-features | JavaScript Stock Charts} and Candlestick or OHLC charts. * * A DataSeries stores the data to render. This is independent from the {@link IRenderableSeries | RenderableSeries} * which defines how that data should be rendered. * * See derived types of {@link BaseDataSeries} to find out what data-series are available. * See derived types of {@link IRenderableSeries} to find out what 2D JavaScript Chart types are available. * * --- * 📚 Docs: {@link https://www.scichart.com/documentation/js/v4/2d-charts/chart-types/data-series-api/data-series-api-overview/} */ export declare class OhlcDataSeries extends BaseDataSeries { /** @inheritDoc */ readonly type = EDataSeriesType.Ohlc; /** * Creates an instance of {@link OhlcDataSeries} * @param webAssemblyContext the {@link TSciChart | SciChart WebAssembly Context} containing native methods * and access to our underlying WebGL2 rendering engine * @param options the {@link IOhlcDataSeriesOptions} which can be passed to configure the DataSeries at construct time * * --- * 📚 Docs: {@link https://www.scichart.com/documentation/js/v4/2d-charts/chart-types/data-series-api/data-series-api-overview/} */ constructor(webAssemblyContext: TSciChart, options?: IOhlcDataSeriesOptions); get yValues(): SCRTDoubleVector; get openValues(): SCRTDoubleVector; get highValues(): SCRTDoubleVector; get lowValues(): SCRTDoubleVector; /** * Gets a native / WebAssembly vector of Open-values in the DataSeries */ getNativeOpenValues(): SCRTDoubleVector; /** * Gets a native / WebAssembly vector of High-values in the DataSeries */ getNativeHighValues(): SCRTDoubleVector; /** * Gets a native / WebAssembly vector of Low-values in the DataSeries */ getNativeLowValues(): SCRTDoubleVector; /** * Gets a native / WebAssembly vector of Close-values in the DataSeries */ getNativeCloseValues(): SCRTDoubleVector; /** * Appends a single X (Date), Open, High, Low, Close point to the DataSeries * @remarks * For best performance on drawing large datasets, use the {@link appendRange} method * X-value is a Date, encoded as a Unix Timestamp. * * Any changes of the DataSeries will trigger a redraw on the parent {@link SciChartSurface} * @param x X-value is a Date, encoded as a Unix Timestamp. * @param open The Open value for this OHLC bar * @param high The High value for this OHLC bar * @param low The Low value for this OHLC bar * @param close The Close value for this OHLC bar * @param metadata The point metadata */ append(x: number, open: number, high: number, low: number, close: number, metadata?: IPointMetadata): void; /** * Appends arrays of X (Date), Open, High, Low, Close point to the DataSeries * @remarks * This method is considerably higher performance than {@link append} which appends a single point * X-value is a Date, encoded as a Unix Timestamp. * * Any changes of the DataSeries will trigger a redraw on the parent {@link SciChartSurface} * @param xValues X-values are Dates, encoded as a Unix Timestamp. * @param openValues The Open values for this OHLC bar * @param highValues The High values for this OHLC bar * @param lowValues The Low values for this OHLC bar * @param closeValues The Close value sfor this OHLC bar * @param metadata The array of point metadata */ appendRange(xValues: NumberArray, openValues: NumberArray, highValues: NumberArray, lowValues: NumberArray, closeValues: NumberArray, metadata?: IPointMetadata[]): void; /** * Updates a single Open, High, Low, Close value by X-index * @remarks Any changes of the DataSeries will trigger a redraw on the parent {@link SciChartSurface} * @param index the index to update * @param open The new Open value * @param high The new High value * @param low The new Low value * @param close The new Close value * @param metadata The point metadata */ update(index: number, open: number, high: number, low: number, close: number, metadata?: IPointMetadata): void; /** * Updates a single X, Open, High, Low, Close value by X-index. Might also need to set isSorted = false * @remarks Any changes of the DataSeries will trigger a redraw on the parent {@link SciChartSurface} * @param index the index to update * @param x The new X value * @param open The new Open value * @param high The new High value * @param low The new Low value * @param close The new Close value * @param metadata The point metadata */ updateXohlc(index: number, x: number, open: number, high: number, low: number, close: number, metadata?: IPointMetadata): void; /** * Inserts a single Date, Open, High, Low, Close value at the X-index * @remarks Any changes of the DataSeries will trigger a redraw on the parent {@link SciChartSurface} * @param startIndex the index to insert at * @param x the X-value (date) encoded as a Unix Timestamp * @param open The Open value * @param high The High value * @param low The Low value * @param close The Close value * @param metadata The point metadata */ insert(startIndex: number, x: number, open: number, high: number, low: number, close: number, metadata?: IPointMetadata): void; /** * Inserts a range of Date, Open, High, Low, Close value at the X-index * @remarks Any changes of the DataSeries will trigger a redraw on the parent {@link SciChartSurface} * @param startIndex the index to insert at * @param xValues the X-values (dates) encoded as a Unix Timestamp * @param openValues The Open values * @param highValues The High values * @param lowValues The Low values * @param closeValues The Close values * @param metadata The array of point metadata */ insertRange(startIndex: number, xValues: NumberArray, openValues: NumberArray, highValues: NumberArray, lowValues: NumberArray, closeValues: NumberArray, metadata?: IPointMetadata[]): void; /** @inheritDoc */ getWindowedYRange(xRange: NumberRange, getPositiveRange: boolean, isXCategoryAxis?: boolean, dataSeriesValueType?: EDataSeriesValueType, yRangeMode?: EYRangeMode): NumberRange; /** @inheritDoc */ protected getOptions(excludeData?: boolean): IOhlcDataSeriesOptions; private getOHLCValues; } export declare function getOHLCYRange(indicesRange: NumberRange, openValues: SCRTDoubleVector, highValues: SCRTDoubleVector, lowValues: SCRTDoubleVector, closeValues: SCRTDoubleVector): NumberRange;