ChartComponent
ChartComponent API
- ChartComponent.doActivate
- Returns
- void
ChartComponent.doActivate(): void
This method overrides the doActivate method of the parent class and calls it. It does not take any parameters and does not return anything.
- ChartComponent.registerDefaultCandlesTransformers
- Returns
- void
ChartComponent.registerDefaultCandlesTransformers(): void
Registers default candle transformers.
- ChartComponent.registerCandlesTransformer
- Parameters
- chartType: keyof BarTypes
- transformer: VisualCandleCalculator
- Returns
- void
ChartComponent.registerCandlesTransformer(chartType: keyof BarTypes, transformer: VisualCandleCalculator): void
You can use this method to determine logic of visual candle transformation for specified chart type.
- ChartComponent.registerLastCandleLabelHandler
- Parameters
- chartType: keyof BarTypes
- handler: LastCandleLabelHandler
- Returns
- void
ChartComponent.registerLastCandleLabelHandler(chartType: keyof BarTypes, handler: LastCandleLabelHandler): void
You can use this method to modify labels for last candle.
- ChartComponent.registerCandlesWidthCalculator
- Parameters
- chartType: keyof BarTypes
- calculator: CandleWidthCalculator
- Returns
- void
ChartComponent.registerCandlesWidthCalculator(chartType: keyof BarTypes, calculator: CandleWidthCalculator): void
You can use this method to determine chart width calculation for specified chart type.
- ChartComponent.registerDefaultDataSeriesDrawers
- Returns
- void
ChartComponent.registerDefaultDataSeriesDrawers(): void
In future this drawers should have same type as main series
- ChartComponent.setChartType
- Parameters
- type: keyof BarTypes
- - new type
- Returns
- void
ChartComponent.setChartType(type: keyof BarTypes): void
Sets the chart type of main candle series.
- ChartComponent.resetChartScale
- Returns
- void
ChartComponent.resetChartScale(): void
Resets chart scale to default according to config.components.chart.defaultZoomCandleWidth.
- ChartComponent.setTimestampRange
- Parameters
- start: number
- - The start timestamp of the range.
- end: number
- - The end timestamp of the range.
- forceNoAnimation: boolean
- - true by default
- Returns
- void
ChartComponent.setTimestampRange(start: number, end: number, forceNoAnimation: boolean): void
Sets the timestamp range of the chart by setting the x-axis scale.
- ChartComponent.setXScale
- Parameters
- xStart: number
- - viewport start in units
- xEnd: number
- - viewport end in units
- forceNoAnimation: boolean
- - true by default
- Returns
- void
ChartComponent.setXScale(xStart: number, xEnd: number, forceNoAnimation: boolean): void
Moves the viewport to exactly xStart..xEnd place.
- ChartComponent.setShowWicks
- Parameters
- isShow: boolean
- - A boolean value indicating whether to show or hide the wicks.
- Returns
- void
ChartComponent.setShowWicks(isShow: boolean): void
Sets the visibility of the wicks in the chart.
- ChartComponent.setApplyBackgroundToAxes
- Parameters
- options: { x: boolean; y: boolean; }
- - options for both axes
- Returns
- void
ChartComponent.setApplyBackgroundToAxes(options: { x: boolean; y: boolean; }): void
Sets the options for the background color applying to the chart axes
- ChartComponent.setMainSeries
- Parameters
- series: CandleSeries
- Returns
- void
ChartComponent.setMainSeries(series: CandleSeries): void
Used to set the main series to chart.
- ChartComponent.setSecondarySeries
- Parameters
- series: CandleSeries
- Returns
- CandleSeriesModel
ChartComponent.setSecondarySeries(series: CandleSeries): CandleSeriesModel
Adds new secondary chart series.
- ChartComponent.setAllSeries
- Parameters
- mainSeries: CandleSeries
- secondarySeries: CandleSeries[]
- Returns
- void
ChartComponent.setAllSeries(mainSeries: CandleSeries, secondarySeries: CandleSeries[]): void
Sets the main and secondary series in one bulk operation. Reindexing and visual rerender happens at the same time.
- ChartComponent.toXFromCandleIndex
- Parameters
- idx: number
- Returns
- number
ChartComponent.toXFromCandleIndex(idx: number): number
Converts candle index to chart x coordinate
- ChartComponent.toXFromTimestamp
- Parameters
- timestamp: number
- Returns
- number
ChartComponent.toXFromTimestamp(timestamp: number): number
Converts timestamp to chart x coordinate
- ChartComponent.toY
- Parameters
- price: number
- Returns
- number
ChartComponent.toY(price: number): number
Converts price to chart y coordinate
- ChartComponent.updateAllSeries
- Parameters
- mainSeries: CandleSeries
- secondarySeries: CandleSeries[]
- Returns
- void
ChartComponent.updateAllSeries(mainSeries: CandleSeries, secondarySeries: CandleSeries[]): void
Updates the main and secondary series in one bulk operation. Reindexing and visual rerender happens at the same time.
- ChartComponent.removeDataFrom
- Parameters
- timestamp: number
- Returns
- void
ChartComponent.removeDataFrom(timestamp: number): void
Removes all data points from the main candle series that are newer than the given timestamp. Can be useful for data replay.
- ChartComponent.removeSecondarySeries
- Parameters
- series: CandleSeriesModel
- Returns
- void
ChartComponent.removeSecondarySeries(series: CandleSeriesModel): void
Removes chart candles series.
- ChartComponent.prependCandles
- Parameters
- target: Candle[]
- - initial candles array
- prependUpdate: Candle[]
- - additional candles array, which will be added to the target array
- Returns
- void
ChartComponent.prependCandles(target: Candle[], prependUpdate: Candle[]): void
Adds new candles array to the existing one at the start, mostly used in lazy loading
- ChartComponent.addLastCandle
- Parameters
- candle: Candle
- - new candle
- instrumentSymbol: string
- - name of the instrument to update
- Returns
- void
ChartComponent.addLastCandle(candle: Candle, instrumentSymbol: string): void
Adds new candle to the chart
- ChartComponent.removeCandleByIdx
- Parameters
- idx: number
- - candle index
- instrumentSymbol: string
- - name of the instrument to update
- Returns
- void
ChartComponent.removeCandleByIdx(idx: number, instrumentSymbol: string): void
Remove candle by idx and recalculate indexes
- ChartComponent.removeCandlesByIdsSequence
- Parameters
- ids: string[]
- - candles ids to remove
- selectedCandleSeries: CandleSeriesModel
- - candle series to remove candles from
- Returns
- void
ChartComponent.removeCandlesByIdsSequence(ids: string[], selectedCandleSeries: CandleSeriesModel): void
Remove candles by ids and recalculate indexes, candles should be as a sequence, follow one by one Works faster than removeCandlesByIds
- ChartComponent.removeCandlesByIds
- Parameters
- ids: string[]
- - candles ids to remove
- selectedCandleSeries: CandleSeriesModel
- - candle series to remove candles from
- Returns
- void
ChartComponent.removeCandlesByIds(ids: string[], selectedCandleSeries: CandleSeriesModel): void
Remove candles by ids and recalculate indexes
- ChartComponent.addCandlesById
- Parameters
- candles: Candle[]
- - candles to add
- startId: string
- - target candle to start adding candles from
- selectedCandleSeries: CandleSeriesModel
- - candle series to add candles to
- Returns
- void
ChartComponent.addCandlesById(candles: Candle[], startId: string, selectedCandleSeries: CandleSeriesModel): void
Add candles by id and recalculate indexes
- ChartComponent.updateLastCandle
- Parameters
- candle: Candle
- - updated candle
- instrumentSymbol: string
- - name of the instrument to update
- Returns
- void
ChartComponent.updateLastCandle(candle: Candle, instrumentSymbol: string): void
Updates last candle value
- ChartComponent.updateCandles
- Parameters
- candles: Candle[]
- instrumentSymbol: string
- - name of the instrument to update
- Returns
- void
ChartComponent.updateCandles(candles: Candle[], instrumentSymbol: string): void
Updates candle series for instrument. By default takes main instrument.
- ChartComponent.setOffsets
- Parameters
- offsets: Partial<ChartConfigComponentsOffsets>
- - new offsets
- Returns
- void
ChartComponent.setOffsets(offsets: Partial<ChartConfigComponentsOffsets>): void
Sets offsets to viewport.
- ChartComponent.getDataSeriesDrawer
- Parameters
- drawerType: keyof BarTypes
- - The type of the drawer to be returned.
- Returns
- SeriesDrawer
ChartComponent.getDataSeriesDrawer(drawerType: keyof BarTypes): SeriesDrawer
Returns a SeriesDrawer object based on the provided drawerType.
- ChartComponent.registerDataSeriesTypeDrawer
- Parameters
- drawerType: string
- - a unique name for the drawer, could be {BarType} - in this case will override default drawer for the type
- drawer: SeriesDrawer
- - an implementation of the drawer
- Returns
- void
ChartComponent.registerDataSeriesTypeDrawer(drawerType: string, drawer: SeriesDrawer): void
Registers a new chart type drawer or overrides default drawer if drawerType is {BarType}.
- ChartComponent.updatePriceIncrementsIfNeeded
- Parameters
- instrument: ChartInstrument
- - The instrument to update the price increments for.
- Returns
- void
ChartComponent.updatePriceIncrementsIfNeeded(instrument: ChartInstrument): void
Updates the price increments of a given instrument if they are not valid or not defined. If the price increments are not valid or not defined, it will set them to a default value.
- ChartComponent.observeOffsetsChanged
- Returns
- Observable<void>
ChartComponent.observeOffsetsChanged(): Observable<void>
Returns an Observable that emits a void value whenever the offsetsChanged event is triggered.
- ChartComponent.observeChartTypeChanged
- Returns
- Observable<keyof BarTypes>
ChartComponent.observeChartTypeChanged(): Observable<keyof BarTypes>
Returns an Observable that emits the BarType whenever the chart type is changed.
- ChartComponent.observeCandlesChanged
- Returns
- Observable<void>
ChartComponent.observeCandlesChanged(): Observable<void>
Returns an Observable that emits a void value when the candles in the chart model change. The Observable is obtained by calling the observeCandlesChanged method of the chartModel object.
- ChartComponent.observeCandlesUpdated
- Returns
- Observable<void>
ChartComponent.observeCandlesUpdated(): Observable<void>
Returns an Observable that emits a void value when the candles are updated in the chart model. The Observable is obtained from the candlesUpdatedSubject of the chartModel.
- ChartComponent.observeCandlesPrepended
- Returns
- Observable<PrependedCandlesData>
ChartComponent.observeCandlesPrepended(): Observable<PrependedCandlesData>
Returns an Observable that emits a void value whenever the candlesPrependSubject is triggered.