overrideIndicator(indicator, paneId?) â
overrideIndicator
override indicator attrs.
Reference â
typescript
(
indicator: {
name: string
shortName?: string
precision?: number
calcParams?: unknown[]
shouldOhlc?: boolean
shouldFormatBigNumber?: boolean
visible?: boolean
zLevel?: number
extendData?: unknown
series?: 'normal' | 'price' | 'volume',
figures?: Array<{
key: string
title?: string
type?: string
baseValue?: number
attrs?: (params: object) => object
styles?: (params: object) => object
}>
minValue?: number
maxValue?: number
styles?: Partial<IndicatorStyle>
shouldUpdate?: (prev: Indicator, current: Indicator) => (boolean | { calc: boolean, draw: boolean })
calc?: (kLineDataList: KLineData[], indicator: Indicator) => unknown[] | Promise<unknown[]>
regenerateFigures?: (calcParams: unknown[]) => Array<{
key: string
title?: string
type?: string
baseValue?: number
attrs?: (params: object) => object
styles?: (params: object) => object
}>
createTooltipDataSource?: (params: object) => ({
name?: string
calcParamsText?: string
icons?: Array<{
id?: string
position?: 'left' | 'middle' | 'right'
color?: string
activeColor?: string
size?: number
fontFamily?: string
icon?: string
backgroundColor?: string
activeBackgroundColor?: string
}>
legends?: Array<{
title: string |
{
text: string
color: string
}
value: string |
{
text: string
color: string
}
}>
})
draw?: (params: object) => boolean
onDataStateChange?: (params: object) => void
},
paneId?: string
) => void
Parameters â
indicator
Indicator configuration.name
Name.shortName
A short name, used for prompt display.precision
Precision.calcParams
Calculate the parameters.shouldOhlc
Whether to show theohlc
bar.shouldFormatBigNumber
Whether big numbers need to be formatted and displayed.visible
Whether it is visible.zLevel
Hierarchy only works between indicators.extendData
Custom the extended data.series
Series, supportsnormal
,price
andvolume
, whenprice
andprecision
is not set, the precision will follow the price precision, whenvolume
andprecision
is not set, the precision will follow the volume precision.figures
Figure configuration, an array of items containingobject
configuration.key
The identifier of the data value, corresponding to thekey
of the data sub-item returned bycalc
.type
The type of figure that supports the type returned byklinecharts.getSupportedFigures
.baseValue
The basic control value, currently only works whentype
isrect
andbar
. When this value is valid, the graphics will be drawn up and down based on this value.attrs
The property value is a method, and the return value is the required property of the object obtained byklinecharts.getFigureClass
.styles
Style is a method that returns the style required by the object obtained byklinecharts.getFigureClass
.
minValue
Specify a minimum value.maxValue
Specifies the maximum value.styles
Style configuration, the type is the same asindicator
in the general styleStyles
.shouldUpdate
Control whether updates are needed.calc
Calculation method.regenerateFigures
Regenerates the basic graphics configuration. This is triggered whencalcParams
changes. The return value type is the same asfigures
.createTooltipDataSource
Create custom prompts.draw
Custom drawing method, if the return value istrue
, it will override the default drawing.onDataStateChange
Data change callback notification.
paneId
Pane id.
Returns â
overrideIndicator
returns undefined
.