ChartComponent

August 17, 2023 ยท View on GitHub

MethodParametersReturnsDescription
doActivatevoidThis method overrides the doActivate method of the parent class and calls it. It does not take any parameters and does not return anything.
registerDefaultCandlesTransformersvoidRegisters default candle transformers.
registerCandlesTransformerchartType: keyof BarTypes transformer: VisualCandleCalculatorvoidYou can use this method to determine logic of visual candle transformation for specified chart type.
registerLastCandleLabelHandlerchartType: keyof BarTypes handler: LastCandleLabelHandlervoidYou can use this method to modify labels for last candle.
registerCandlesWidthCalculatorchartType: keyof BarTypes calculator: CandleWidthCalculatorvoidYou can use this method to determine chart width calculation for specified chart type.
registerDefaultDataSeriesDrawersvoidIn future this drawers should have same type as main series
setChartTypetype: keyof BarTypes - new typevoidSets the chart type of main candle series.
resetChartScalevoidResets chart scale to default according to config.components.chart.defaultZoomCandleWidth.
setTimestampRangestart: number - The start timestamp of the range.end: number - The end timestamp of the range.voidSets the timestamp range of the chart by setting the x-axis scale.
setXScalexStart: number - viewport start in unitsxEnd: number - viewport end in unitsvoidMoves the viewport to exactly xStart..xEnd place.
setShowWicksisShow: boolean - A boolean value indicating whether to show or hide the wicks.voidSets the visibility of the wicks in the chart.
setMainSeriesseries: CandleSeriesvoidUsed to set the main series to chart.
setSecondarySeriesseries: CandleSeriesCandleSeriesModelAdds new secondary chart series.
setAllSeriesmainSeries: CandleSeries secondarySeries: CandleSeries[]voidSets the main and secondary series in one bulk operation. Reindexing and visual rerender happens at the same time.
toXFromCandleIndexidx: numbernumberConverts candle index to chart x coordinate
toXFromTimestamptimestamp: numbernumberConverts timestamp to chart x coordinate
toYprice: numbernumberConverts price to chart y coordinate
updateAllSeriesmainSeries: CandleSeries secondarySeries: CandleSeries[]voidUpdates the main and secondary series in one bulk operation. Reindexing and visual rerender happens at the same time.
removeDataFromtimestamp: numbervoidRemoves all data points from the main candle series that are newer than the given timestamp. Can be useful for data replay.
removeSecondarySeriesseries: CandleSeriesModelvoidRemoves chart candles series.
prependCandlestarget: Candle[] - initial candles arrayprependUpdate: Candle[] - additional candles array, which will be added to the target arrayvoidAdds new candles array to the existing one at the start, mostly used in lazy loading
addLastCandlecandle: Candle - new candleinstrumentSymbol: stringvoidAdds new candle to the chart
updateLastCandlecandle: Candle - updated candleinstrumentSymbol: stringvoidUpdates last candle value
updateCandlescandles: Candle[] instrumentSymbol: stringvoidUpdates candle series for instrument. By default takes main instrument.
setOffsetsoffsets: Partial<ChartConfigComponentsOffsets> - new offsetsvoidSets offsets to viewport.
getDataSeriesDrawerdrawerType: keyof BarTypes - The type of the drawer to be returned.SeriesDrawerReturns a SeriesDrawer object based on the provided drawerType.
registerDataSeriesTypeDrawerdrawerType: string - a unique name for the drawer, could be {BarType} - in this case will override default drawer for the typedrawer: SeriesDrawer - an implementation of the drawervoidRegisters a new chart type drawer or overrides default drawer if drawerType is {BarType}.
updatePriceIncrementsIfNeededinstrument: ChartInstrument - The instrument to update the price increments for.voidUpdates 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.
observeOffsetsChangedObservable<void>Returns an Observable that emits a void value whenever the offsetsChanged event is triggered.
observeChartTypeChangedObservable<keyof BarTypes>Returns an Observable that emits the BarType whenever the chart type is changed.
observeCandlesChangedObservable<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.
observeCandlesUpdatedObservable<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.
observeCandlesPrependedObservable<PrependedCandlesData>Returns an Observable that emits a void value whenever the candlesPrependSubject is triggered.