init(ds, options?) โ
init
used to initialize a chart.
Tip
When calling, you need to wait until the container dom
is ready.
Reference โ
typescript
(
ds: string | HTMLElement,
options?: {
layout?: Array<{
type: 'candle' | 'indicator' | 'xAxis'
content?: Array<Indicator | string>
options?: {
id?: string
height?: number
minHeight?: number
dragEnabled?: boolean
order?: number
state?: 'normal' | 'maximize' | 'minimize'
axis?: {
name?: string
reverse?: boolean
inside?: boolean
position?: 'left' | 'right'
scrollZoomEnabled?: boolean
gap?: {
top?: number
bottom?: number
}
}
}
}>
locale?: string
styles?: string | Styles
timezone?: string
customApi?: {
formatDate?: (timestamp: number, format: string, type: number) => string
formatBigNumber?: (value: string | number) => string
}
thousandsSeparator?: {
sign?: string
format: (value: number | string) => string
}
decimalFold?: {
threshold?: number
format?: (value: number | string) => string
}
}
) => Chart
Parameters โ
ds
Container, which can be a DOM element or an element id.options
Optional configuration item.layout
Custom layout, an array.type
Pane type, supportscandle
,indicator
andxAxis
.content
Pane content, only supports indicators.options
Pane configuration.id
Pane id.height
Height.minHeight
Min height.dragEnabled
Whether the height can be adjusted by dragging.order
Order.state
State, supportsnormal
,maximize
andminimize
.axis
Axis configuration.name
The name of the axis.reverse
Whether to reverse.inside
Whether it is inside.position
Position, supportsleft
andright
.scrollZoomEnabled
Whether to allow scrolling and zooming.gap
Top and bottom margin configuration.top
Top margin.bottom
Bottom margin.
locale
Locale, with built-in support forzh-CN
anden-US
.timezone
Timezone name, such asAsia/Shanghai
. If not set, the local time zone will be automatically obtained. For a list of time zone names, please refer to the Timezone List .styles
It can be a style name registered byklinecharts.registerStyles
orStyles
. For details aboutStyles
, see Styles. Incremental values โโare supported.customApi
Customize some APIs.formatDate
Formats a date.formatBigNumber
Format big numbers, such as 1000 is converted to 1k, 1000000 is converted to 1M, etc.
thousandsSeparator
Thousand separator configuration.sign
Sign.format
Custom formatting method.
decimalFold
Decimal 0 folds the configuration.threshold
Fold threshold.format
Custom formatting method.
Returns โ
init
returns an object Chart
ใ