overrideIndicator(indicator)
overrideIndicator override indicator attrs.
Reference
typescript
(
indicator: {
id?: string
paneId?: string
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
features?: Array<{
id?: string
position?: 'left' | 'middle' | 'right'
marginLeft?: number
marginTop?: number
marginRight?: number
marginBottom?: number
paddingLeft?: number
paddingTop?: number
paddingRight?: number
paddingBottom?: number
size?: number
color?: string
activeColor?: string
backgroundColor?: string
activeBackgroundColor?: string
type?: 'path' | 'icon_font'
path?: {
style?: 'stroke' | 'fill'
path?: string
lineWidth?: number
}
iconFont?: {
content?: string
family?: string
}
}>
legends?: Array<{
title: string |
{
text: string
color: string
}
value: string |
{
text: string
color: string
}
}>
})
draw?: (params: object) => boolean
onDataStateChange?: (params: object) => void
}
) => voidParameters
indicatorIndicator configuration.idID.paneIdPane id.nameName.shortNameA short name, used for prompt display.precisionPrecision.calcParamsCalculate the parameters.shouldOhlcWhether to show theohlcbar.shouldFormatBigNumberWhether big numbers need to be formatted and displayed.visibleWhether it is visible.zLevelHierarchy only works between indicators.extendDataCustom the extended data.seriesSeries, supportsnormal,priceandvolume, whenpriceandprecisionis not set, the precision will follow the price precision, whenvolumeandprecisionis not set, the precision will follow the volume precision.figuresFigure configuration, an array of items containingobjectconfiguration.keyThe identifier of the data value, corresponding to thekeyof the data sub-item returned bycalc.typeThe type of figure that supports the type returned byklinecharts.getSupportedFigures.baseValueThe basic control value, currently only works whentypeisrectandbar. When this value is valid, the graphics will be drawn up and down based on this value.attrsThe property value is a method, and the return value is the required property of the object obtained byklinecharts.getFigureClass.stylesStyle is a method that returns the style required by the object obtained byklinecharts.getFigureClass.
minValueSpecify a minimum value.maxValueSpecifies the maximum value.stylesStyle configuration, the type is the same asindicatorin the general styleStyles.shouldUpdateControl whether updates are needed.calcCalculation method.regenerateFiguresRegenerates the basic graphics configuration. This is triggered whencalcParamschanges. The return value type is the same asfigures.createTooltipDataSourceCreate custom prompts.drawCustom drawing method, if the return value istrue, it will override the default drawing.onDataStateChangeData change callback notification.
Tip:
Among them, id , paneId and name are indexes. If the input parameters contain these three parameters, the indicators that meet the conditions will be searched for overwriting based on these three parameters.Returns
overrideIndicator returns undefined .