Instance API â
getDom(paneId, position) â
(paneId?: string, position?: 'root' | 'main' | 'yAxis') => HTMLElementGet the dom container.
paneIdwindow id, the default is the entire chart containerpositionsupportsroot,main,yAxis, the default isroot
getSize(paneId, position) â
(paneId?: string, position?: 'root' | 'main' | 'yAxis') => {
width: number
height: number
left: number
top: number
right: number
bottom: number
}Get the dimensions.
paneIdwindow id, the default is the entire chart containerpositionposition, supportsroot,main,yAxis, the default isroot
setStyles(styles) â
(styles: string | object) => HTMLElementSet style configuration.
stylesstyle configuration, which can be the style name registered throughregisterStyles. When it is an object, please refer to styles for details, and it supports merging.
getStyles() â
() => objectGet the style configuration, return the complete type refer to styles.
setPriceVolumePrecision(pricePrecision, volumePrecision) â
(pricePrecision: number, volumePrecision: number) => voidSetting the price and volume precision, while the technical indicator series is 'price' or 'volume' will also be affected.
pricePrecisionprice precisionvolumePrecisionvolume precision
setTimezone(timezone) â
(timezone: string) => voidSet the time zone.
timezonetime zone name, such as 'Asia/Shanghai', if not set, it will automatically get the local time zone, please refer to Time Zone List.
getTimezone() â
() => stringGet the chart time zone name.
setZoomEnabled(enabled) â
(enabled: boolean) => voidSet whether to scale.
isZoomEnabled() â
() => booleanWhether it can be scaled.
setScrollEnabled(enabled) â
(enabled: boolean) => voidSet whether dragging and scrolling is possible.
isScrollEnabled() â
() => booleanWhether dragging and scrolling is possible.
setOffsetRightDistance(distance) â
(distance: number) => voidSet the gap that can be left to the right of the chart.
getOffsetRightDistance() ^9.2.0 â
() => numberGet the gap that can be left to the right of the chart.
setMaxOffsetLeftDistance() ^9.7.0 â
(distance: number) => voidSet the maximum available gap on the left side of the chart.
setMaxOffsetRightDistance() ^9.7.0 â
(distance: number) => voidSet the maximum available gap on the right side of the chart.
setLeftMinVisibleBarCount(barCount) â
(barCount: number) => voidSet the minimum number of visible candles to the left.
setRightMinVisibleBarCount(barCount) â
(barCount: number) => voidSet the minimum number of visible candles to the right.
setBarSpace(space) â
(space: number) => voidSet the width of a single candlestick of the chart.
getBarSpace() â
() => numberGets the width of a single candlestick on the chart.
getVisibleRange() â
() => {
from: number
to: number
realFrom: number
realTo: number
}Get visible range.
applyNewData(dataList, more, callback) â
(
dataList: Array<{
timestamp: number
open: number
close: number
high: number
low: number
volume?: number
turnover?: number
}>,
more?: boolean,
callback?: () => void
) => voidAdd new data, this method will clear the chart data, no need to call the clearData method additionally.
dataListis an array of K-line data. For details of the data type, please refer to datamoretells the chart whether there is more historical data, can be defaulted, the default is truecallbacksuccess callback ^9.2.0
Note
callback has been deprecated since version 9.8.0, use subscribeAction('onDataReady', () => {}) instead.
applyMoreData(dataList, more, callback) â
(
dataList: Array<{
timestamp: number
open: number
close: number
high: number
low: number
volume?: number
turnover?: number
}>,
more?: boolean,
callback?: () => void
) => voidAdd more historical data.
dataListis an array of K-line data. For details of the data type, please refer to datamoretells the chart whether there is more historical data, can be defaulted, the default is truecallbacksuccess callback ^9.2.0
Note
This api has been deprecated since version 9.8.0.
updateData(data, callback) â
(
data: {
timestamp: number
open: number
close: number
high: number
low: number
volume?: number
turnover?: number
},
callback?: () => void
) => voidUpdate data. Currently, only the timestamp of the last piece of data will be matched. If it is the same, it will be overwritten, and if it is different, it will be appended.
datasingle k-line data, please refer to data for details of data typecallbacksuccess callback ^9.2.0
Note
callback has been deprecated since version 9.8.0, use subscribeAction('onDataReady', () => {}) instead.
getDataList() â
() => Array<{
timestamp: number
open: number
close: number
high: number
low: number
volume?: number
turnover?: number
}>Get the current data source of the chart. For the returned data type, please refer to data.
clearData() â
() => voidClear the data of the chart. Generally, it is not necessary to call it manually. In order to avoid repeated drawing, the data is only cleared here, and the chart will not be redrawn.
loadMore(cb) â
(cb: (timestamp: number | null) => void) => voidSet load more callback function.
cbis a callback method,timestampis the timestamp of the first piece of data
Note
This api has been deprecated since version 9.8.0, use setLoadDataCallback instead.
setLoadDataCallback(cb) ^9.8.0 â
(
cb: (params: {
type: 'forward' | 'backward'
data: Nullable<KLineData>
callback: (dataList: KLineData[], more?: boolean) => void
}) => void
) => voidSet auto load data callback
cbcallbackparamsparamstypeforward or backwarddataboundary datacallbackused for returning data to chart
createIndicator(value, isStack, paneOptions, callback) â
(
value: string | {
name: string
shortName?: string
precision?: number
calcParams?: any[]
shouldOhlc?: boolean
shouldFormatBigNumber?: boolean
visible?: boolean
zLevel?: number
extendData?: any
series?: 'normal' | 'price' | 'volume'
figures?: Array<{
key: string
title?: string
type?: string
baseValue?: number
attrs?: ({
data: object
coordinate: object
bounding: object
barSpace: object
xAxis: object
yAxis: object
}) => object
styles?: (
data: object,
indicator: object,
defaultStyles: object
) => ({
style?: 'solid' | 'dashed' | 'stroke' | 'fill' | 'stroke_fill'
color?: string
})
}>
minValue?: number
maxValue?: number
styles?: object
calc?: (dataList: KLineData[], indicator: object) => Promise<object[]> | object[]
regenerateFigures?: (calcParms: any[]) => Array<{
key: string
title?: string
type?: string
baseValue?: number
styles?: (
data: object,
indicator: object,
defaultStyles: object
) => ({
style?: 'solid' | 'dashed' | 'stroke' | 'fill' | 'stroke_fill'
color?: string
})
}>
createTooltipDataSource?: (params: object) => ({
name?: string
calcParamsText?: string
values?: Array<{
title: string | {
text: string
color: string
}
value: string | {
text: string
color: string
}
}>
})
draw?: (params: object) => boolean
},
isStack?: boolean,
paneOptions?: {
id?: string
height?: number
minHeight?: number
dragEnabled?: boolean
position?: 'top' | 'bottom'
gap?: {
top?: number
bottom?: number
}
axisOptions?: {
name?: string
scrollZoomEnabled?: boolean
}
} | null,
callback?: () => void
) => string | nullCreate a technical indicator, the return value is a string that identifies the window, which is very important, and this identification is required for some subsequent operations on the window.
valuetechnical indicator name or technical indicator object, when it is an object, the type is consistent with the input parameter of the chart methodoverrideIndicatorisStackis overridespaneOptionswindow configuration information, can be defaultidwindow id, can be defaultheightwindow height, can be defaultminHeightminimum height of the window, can be defaulteddragEnabledWhether the window can be dragged to adjust the height, it can be defaultedpositionOnly valid when creating a new pane ^9.6.0gapmarginstoptop margin, value less than 1 is a percentagebottombottom margin, value less than 1 is a percentage
axisOptionsnameis sameaxis.namein registerYAxis(axis) of chart api, default is 'default' ^9.8.0scrollZoomEnabledScroll zoom flag ^9.3.0
callbacksuccess callback
Special id
'candle_pane', the window id of the main picture.
Example:
chart.createIndicator('MA', false, {
id: 'pane_1',
height: 100,
minHeight: 30,
dragEnabled: true,
gap: { top: 0.2, bottom: 0.1 },
axisOptions: { scrollZoomEnabled: true }
}, () => {})overrideIndicator(override, paneId, callback) â
(
override: {
name: string
shortName?: string
precision?: number
calcParams?: any[]
shouldOhlc?: boolean
shouldFormatBigNumber?: boolean
visible?: boolean
zLevel?: number
extendData?: any
series?: 'normal' | 'price' | 'volume'
figures?: Array<{
key: string
title?: string
type?: string
baseValue?: number
attrs?: ({
data: object
coordinate: object
bounding: object
barSpace: object
xAxis: object
yAxis: object
}) => object
styles?: (
data: object,
indicator: object,
defaultStyles: object
) => ({
style?: 'solid' | 'dashed' | 'stroke' | 'fill' | 'stroke_fill'
color?: string
})
}>
minValue?: number
maxValue?: number
styles?: object
calc?: (dataList: KLineData[], indicator: object) => Promise<object[]> | object[]
regenerateFigures?: (calcParms: any[]) => Array<{
key: string
title?: string
type?: string
baseValue?: number
styles?: (
data: object,
indicator: object,
defaultStyles: object
) => ({
style?: 'solid' | 'dashed' | 'stroke' | 'fill' | 'stroke_fill'
color?: string
})
}>
createTooltipDataSource?: (params: object) => {
name?: string
calcParamsText?: string
values?: Array<{
title: string | { text: string, color: string }
value: string | { text: string, color: string }
}>
}
draw?: (params: object) => boolean
},
paneId?: string | null,
callback?: () => void
) => voidOverlay technical indicator information.
overridesome parameters that need to be overriddennamemetric name, unique identifier for creation and operationshortNameshort name for displayprecisionprecisioncalcParamscalculation parametersshouldOhlcneeds ohlc auxiliary graphicsshouldFormatBigNumbershould format large numbers. For example, 1000 is converted to 1k, 1000000 is converted to 1M, etc.visiblevisible or notzLevelz level ^9.7.0extendDataextended dataseriesindicator series, optional options are 'normal', 'price' and 'volume'figuresgraphics configurationminValuespecifies the minimum valuemaxValuespecifies the maximum valuestylesstylescalccalculation methodregenerateFiguresmethod to regenerate figure informationcreateTooltipDataSourcemethod to create custom tip informationdrawcustom drawing method
paneIdwindow id, default is set to allcallbacksuccess callback
Special id
'candle_pane', the window id of the main picture.
Example:
chart.overrideIndicator({
name: 'BOLL',
showName: 'BOLL'
calcParams: [20, 5.5],
precision: 4,
shouldOhlc: true,
shouldFormatBigNumber: false,
visible: true,
zLevel: 1,
extendData: 2432435,
series: 'price',
figures: [],
minValue: null,
maxValue: null,
calc: () => [],
regenerateFigures: () => [],
draw: () => {},
styles: {
bars: [{
style: 'fill,
borderStyle: 'solid,
borderSize: 1,
borderDashedValue: [2, 2],
upColor: '#26A69A',
downColor: '#EF5350',
noChangeColor: '#888888'
}],
lines: [{
size: 1,
style: 'solid',
dashedValue: [2, 2],
color: '#FF9600'
}],
circles: [{
style: 'fill,
borderStyle: 'solid,
borderSize: 1,
borderDashedValue: [2, 2],
upColor: '#26A69A',
downColor: '#EF5350',
noChangeColor: '#888888'
}]
}
}, 'candle_pane', () => {})getIndicatorByPaneId(paneId, name) â
(paneId?: string, name?: string) => objectObtain technical indicator information according to the window id.
paneIdwindow id, that is, the window ID returned when calling thecreateIndicatormethod, can be defaulted, and all will be returned by default.nametechnical indicator name
Special id
'candle_pane', the window id of the main picture.
removeIndicator(paneId, name) â
(paneId: string, name?: string) => objectRemove technical indicators.
paneIdwindow id, that is, the window ID returned when calling thecreateIndicatormethodnametechnical indicator name, if default, will remove all
Special id
'candle_pane', the window id of the main picture.
createOverlay(value, paneId) â
(
value: string | {
name: string
id?: string
groupId?: string
lock?: boolean
visible?: boolean
zLevel?: number
needDefaultPointFigure?: boolean
needDefaultXAxisFigure?: boolean
needDefaultYAxisFigure?: boolean
mode?: 'normal' | 'weak_magnet' | 'strong_magnet'
modeSensitivity?: number
points?: Array<{
timestamp?: number
dataIndex?: number
value?: number
}>
extendData?: any
styles?: object
onDrawStart?: (event: object) => boolean
onDrawing?: (event: object) => boolean
onDrawEnd?: (event: object) => boolean
onClick?: (event: object) => boolean
onDoubleClick?: (event: object) => boolean
onRightClick?: (event: object) => boolean
onPressedMoveStart?: (event: object) => boolean
onPressedMoving?: (event: object) => boolean
onPressedMoveEnd?: (event: object) => boolean
onMouseEnter?: (event: object) => boolean
onMouseLeave?: (event: object) => boolean
onRemoved?: (event: object) => boolean
onSelected?: (event: object) => boolean
onDeselected?: (event: object) => boolean
} | Array<string | {
name: string
id?: string
groupId?: string
lock?: boolean
visible?: boolean
zLevel?: number
needDefaultPointFigure?: boolean
needDefaultXAxisFigure?: boolean
needDefaultYAxisFigure?: boolean
mode?: 'normal' | 'weak_magnet' | 'strong_magnet'
modeSensitivity?: number
points?: Array<{
timestamp?: number
dataIndex?: number
value?: number
}>
extendData?: any
styles?: object
onDrawStart?: (event: object) => boolean
onDrawing?: (event: object) => boolean
onDrawEnd?: (event: object) => boolean
onClick?: (event: object) => boolean
onDoubleClick?: (event: object) => boolean
onRightClick?: (event: object) => boolean
onPressedMoveStart?: (event: object) => boolean
onPressedMoving?: (event: object) => boolean
onPressedMoveEnd?: (event: object) => boolean
onMouseEnter?: (event: object) => boolean
onMouseLeave?: (event: object) => boolean
onRemoved?: (event: object) => boolean
onSelected?: (event: object) => boolean
onDeselected?: (event: object) => boolean
}>,
paneId?: string
) => string | nullCreates an overlay, returning an identifier of type String.
valueOverlay name or object, when it is an object, the parameters are consistent withoverrideOverlaypaneIdwindow id, can be default
Special id
'candle_pane', the window id of the main picture.
Example:
chart.createOverlay({
name: 'segment',
id: 'segment_1',
groupId: 'segment',
points: [
{ timestamp: 1614171282000, value: 18987 },
{ timestamp: 1614171202000, value: 16098 },
],
styles: {
line: {
style: 'solid',
dashedValue: [2, 2],
color: '#f00',
size: 2
}
},
lock: false,
visible: true,
zLevel: 0,
mode: 'weak_magnet',
modeSensitivity: 8,
extendData: 'xxxxxxxx',
needDefaultPointFigure: false,
needDefaultXAxisFigure: false,
needDefaultYAxisFigure: false,
onDrawStart: function (event) { console. log(event) },
onDrawing: function (event) { console. log(event) },
onDrawEnd: function (event) { console. log(event) },
onClick: function (event) { console. log(event) },
onDoubleClick: function (event) { console. log(event) },
onRightClick: function (event) {
console. log(event)
return false
},
onMouseEnter: function (event) { console. log(event) },
onMouseLeave: function (event) { console. log(event) },
onPressedMoveStart: function (event) { console. log(event) },
onPressedMoving: function (event) { console. log(event) },
onPressedMoveEnd: function (event) { console. log(event) },
onRemoved: function (event) { console. log(event) },
onSelected: function (event) { console. log(event) },
onDeselected: function (event) { console. log(event) }
})getOverlayById(id) â
(id: string) => objectGet overlay information by id.
idcalls thecreateOverlaymethod to return the ID
overrideOverlay(override) â
(
override: {
name: string
id?: string
groupId?: string
lock?: boolean
visible?: boolean
zLevel?: number
needDefaultPointFigure?: boolean
needDefaultXAxisFigure?: boolean
needDefaultYAxisFigure?: boolean
mode?: 'normal' | 'weak_magnet' | 'strong_magnet'
modeSensitivity?: number
points?: Array<{
timestamp?: number
dataIndex?: number
value?: number
}>
extendData?: any
styles?: object
onDrawStart?: (event: object) => boolean
onDrawing?: (event: object) => boolean
onDrawEnd?: (event: object) => boolean
onClick?: (event: object) => boolean
onDoubleClick?: (event: object) => boolean
onRightClick?: (event: object) => boolean
onPressedMoveStart?: (event: object) => boolean
onPressedMoving?: (event: object) => boolean
onPressedMoveEnd?: (event: object) => boolean
onMouseEnter?: (event: object) => boolean
onMouseLeave?: (event: object) => boolean
onRemoved?: (event: object) => boolean
onSelected?: (event: object) => boolean
onDeselected?: (event: object) => boolean
}
) => string | nullOverlays that have been drawn.
overrideparameters that need to be overriddennameoverlay name, unique identifier for creationidOverlay identification, if the id exists, it will be based on the id to overwritegroupIdGroup idlockis locked to prevent draggingvisiblevisible or notzLevelDraw levelneedDefaultPointFigureneeds a default point figureneedDefaultXAxisFigureneeds the default x-axis figureneedDefaultYAxisFigureneeds the default y-axis figuremodemode, options are 'normal', 'weak_magnet' and 'strong_magnet'modeSensitivitymode sensitivity, only valid when mode is weak_magnet ^9.5.0pointspoint informationextendDataextended datastylesstylesonDrawStartstart drawing eventonDrawingdrawing eventonDrawEnddraw end eventonClickclick eventonDoubleClickdouble click event ^9.5.0onRightClickright click eventonPressedMoveStartpress start move eventonPressedMovingPress and move eventonPressedMoveEndPress and move end eventonMouseEntermouse enter eventonMouseLeavemouse out eventonRemoveddelete eventonSelectedselected eventonDeselecteddeselected event
Example:
chart.overrideOverlay({
name: 'segment',
id: 'segment_1',
groupId: 'segment',
points: [
{ timestamp: 1614171282000, value: 18987 },
{ timestamp: 1614171202000, value: 16098 },
],
styles: {
line: {
style: 'solid',
dashedValue: [2, 2],
color: '#f00',
size: 2
}
},
lock: false,
visible: true,
zLevel: 0,
mode: 'weak_magnet',
modeSensitivity: 8
extendData: 'xxxxxxxx',
needDefaultPointFigure: false,
needDefaultXAxisFigure: false,
needDefaultYAxisFigure: false,
onDrawStart: function (event) { console. log(event) },
onDrawing: function (event) { console. log(event) },
onDrawEnd: function (event) { console. log(event) },
onClick: function (event) { console. log(event) },
onDoubleClick: function (event) { console. log(event) },
onRightClick: function (event) {
console. log(event)
return false
},
onMouseEnter: function (event) { console. log(event) },
onMouseLeave: function (event) { console. log(event) },
onPressedMoveStart: function (event) { console. log(event) },
onPressedMoving: function (event) { console. log(event) },
onPressedMoveEnd: function (event) { console. log(event) },
onRemoved: function (event) { console. log(event) },
onSelected: function (event) { console. log(event) },
onDeselected: function (event) { console. log(event) }
})removeOverlay(remove) â
(
remove: string | {
id?: string
groupId?: string
name?: string
}
) => voidRemove graphics.
idThe ID returned by calling thecreateOverlaymethod.groupIdGroup idnameOverlay name
scrollByDistance(distance, animationDuration) â
(distance: number, animationDuration?: number) => voidScroll a certain distance.
distancedistanceanimationDurationanimation time, can be default, default is no animation
scrollToRealTime(animationDuration) â
(distance: number, animationDuration?: number) => voidScroll to original position.
animationDurationanimation time, can be default, default is no animation
scrollToDataIndex(dataIndex, animationDuration) â
(dataIndex: number, animationDuration?: number) => voidScroll to the specified location.
dataIndexthe index of the dataanimationDurationanimation time, can be default, default is no animation
scrollToTimestamp(timestamp, animationDuration) â
(timestamp: number, animationDuration?: number) => voidScroll to the specified timestamp.
timestamptimestampanimationDurationanimation time, can be default, default is no animation
zoomAtCoordinate(scale, coordinate, animationDuration) â
(
scale: number,
coordinate?: {
x: number
y: number
},
animationDuration?: number
) => voidScale at a certain coordinate point.
scalescaling factorcoordinatecoordinate point, can be defaulted, the default is to zoom in the middle of the chartanimationDurationanimation time, can be default, default is no animation
zoomAtDataIndex(scale, dataIndex, animationDuration) â
(scale: number, dataIndex: number, animationDuration?: number) => voidScale at a certain position.
scalescaling factordataIndexthe index of the dataanimationDurationanimation time, can be default, default is no animation
zoomAtTimestamp(scale, timestamp, animationDuration) â
(scale: number, timestamp: number, animationDuration?: number) => voidScale on the specified timestamp.
scalescaling factortimestamptimestampanimationDurationanimation time, can be default, default is no animation
setPaneOptions(options) â
(
options: {
id: string
height?: number
minHeight?: number
dragEnabled?: boolean
gap?: {
top?: number
bottom?: number
}
axisOptions?: {
name?: string
scrollZoomEnabled?: boolean
}
}
) => voidSet window configuration.
optionswindow configuration information, can be defaultidwindow idheightwindow height, can be defaultminHeightminimum height of the window, can be defaulteddragEnabledWhether the window can be dragged to adjust the height, it can be defaultedgapmarginstoptop margin, value less than 1 is a percentagebottombottom margin, value less than 1 is a percentage
axisOptionsnameaxis name ^9.8.0scrollZoomEnabledScroll zoom flag ^9.3.0
Special id
'candle_pane', the window id of the main picture.
Example:
chart.setPaneOptions({
id: 'pane_1',
height: 100,
minHeight: 3,
dragEnabled: true,
gap: { top: 0.2, bottom: 0.1 },
axisOptions: { name: 'default', scrollZoomEnabled: true }
})executeAction(type, data) ^9.2.0 â
(
type: 'onCrosshairChange',
data: any => void
) => voidExecute chart action.
typeonly supported 'onCrosshairChange'datadata required for execution
subscribeAction(type, callback) â
(
type: 'onDataReady' | 'onZoom' | 'onScroll' | 'onVisibleRangeChange' | 'onCrosshairChange' | 'onCandleBarClick' | 'onTooltipIconClick' | 'onPaneDrag',
callback: (data?: any) => void
) => voidSubscribe to chart actions.
typeoptions are 'onDataReady', 'onZoom', 'onScroll', 'onVisibleRangeChange', 'onCandleBarClick', 'onTooltipIconClick', 'onCrosshairChange' and 'onPaneDrag'callbackis a callback method
unsubscribeAction(type, callback) â
(
type: 'onDataReady' | 'onZoom' | 'onScroll' | 'onVisibleRangeChange' | 'onCrosshairChange' | 'onCandleBarClick' | 'onTooltipIconClick' | 'onPaneDrag',
callback?: (data?: any) => void
) => voidUnsubscribe from chart actions.
typeoptions are 'onDataReady', 'onZoom', 'onScroll', 'onVisibleRangeChange', 'onCandleBarClick', 'onTooltipIconClick', 'onCrosshairChange' and 'onPaneDrag'callbackis the callback method when subscribing, the default is to cancel all the current types
convertToPixel(value, finder) â
(
value: {
dataIndex?: number
timestamp?: number
value?: number
} | Array<{
dataIndex?: number
timestamp?: number
value?: number
}>,
finder: {
paneId?: string,
absolute?: boolean
}
) => { x: number?, y?: number } | Array<{ x?: number, y?: number }>Convert values to coordinates.
valueThe value to be converted, it can be an object or an arraydataIndexdata index, ifdataIndexandtimestampexist at the same time, it will be converted according to the indextimestamptimestampvaluecorresponds to the value of the y-axis
finderfilterpaneIdwindow idabsoluteis an absolute coordinate, only works on the y axis
convertFromPixel(coordinate, finder) â
(
coordinate: {
x?: number
y?: number
} | Array<{
x?: number
y?: number
},
finder: {
paneId?: string
absolute?: boolean
}
) => {
dataIndex?: number
timestamp?: number
value?: number
} | Array<{
dataIndex?: number
timestamp?: number
value?: number
}>Convert coordinates to values.
coordinateneeds to be converted, it can be an object or an arrayfinderfilterpaneIdwindow idabsoluteis an absolute coordinate, only works on the y axis
getConvertPictureUrl(includeOverlay, type, backgroundColor) â
(includeOverlay?: boolean, type?: string, backgroundColor?: string) => stringGet the image url after the chart is converted into an image.
includeOverlayneeds to include the overlay layer, it can be defaultedtypeThe converted image type, one of the three types of 'png', 'jpeg', 'bmp', can be defaulted, the default is 'jpeg'backgroundColorbackground color, can be defaulted, the default is '#FFFFFF'
resize() â
() => voidResizing the chart will always fill the container size.
Note
This method will recalculate the size of each module in the entire chart, frequent calls may affect performance, please call with caution.