init(ds, options?)
init used to initialize a chart.
Tip:
When calling, you need to wait until the container 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
}
createRange?: (params: object) => ({
from: number
to: number
range: number
realFrom: number
realTo: number
realRange: number
displayFrom: number
displayTo: number
displayRange: number
})
createTicks?: (params: object) => Array<{
coord: number
value: number | string
text: string
}>
}
}
}>
locale?: string
styles?: string | Styles
timezone?: string
formatter?: {
formatDate?: (params: {
dateTimeFormat: Intl.DateTimeFormat
timestamp: number
template: string
type: 'tooltip' | 'crosshair' | 'xAxis'
}) => string
formatBigNumber?: (value: string | number) => string
}
thousandsSeparator?: {
sign?: string
format: (value: number | string) => string
}
decimalFold?: {
threshold?: number
format?: (value: number | string) => string
}
}
) => ChartParameters
dsContainer, which can be a DOM element or an element id.optionsOptional configuration item.layoutCustom layout, an array.typePane type, supportscandle,indicatorandxAxis.contentPane content, only supports indicators.optionsPane configuration.idPane id.heightHeight.minHeightMin height.dragEnabledWhether the height can be adjusted by dragging.orderOrder.stateState, supportsnormal,maximizeandminimize.axisAxis configuration.nameThe name of the axis.reverseWhether to reverse.insideWhether it is inside.positionPosition, supportsleftandright.scrollZoomEnabledWhether to allow scrolling and zooming.gapTop and bottom margin configuration.topTop margin.bottomBottom margin.
createRangeCreate an axis value range callback method.createTicksCreate ticks information callback method.
localeLocale, with built-in support forzh-CNanden-US.timezoneTimezone 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 .stylesIt can be a style name registered byklinecharts.registerStylesorStyles. For details aboutStyles, see Styles. Incremental values are supported.formatterSome format APIs.formatDateFormats a date.formatBigNumberFormat big numbers, such as 1000 is converted to 1k, 1000000 is converted to 1M, etc.
thousandsSeparatorThousand separator configuration.signSign.formatCustom formatting method.
decimalFoldDecimal 0 folds the configuration.thresholdFold threshold.formatCustom formatting method.
Returns
init returns an object Chart。