đ ī¸ From V8 to V9 â
This document will help you upgrade from kinecharts 8.x to klinecharts 9.x. If you are 7.x or older, please refer to the previous upgrade document to upgrade to 8.x.
Import adjustment â
klinecharts/index.blank' and klinecharts/index.simple are no longer distinguished. Please use import {...} from klinecharts uniformly.
Design adjustment â
shape, annotation, tag are merged into overlay. Please refer to overlay for details.
Style configuration adjustment â
- The style options of all lines are changed to
dashedanddashValuetodashedValue. candle.tooltip.labelsandcandle.tooltip.valuesare merged intocandle.tooltip.custom.xAxis.heightis changed toxAxis.size,xAxis.tickeText.paddingTopis changed toxAxis.tickeText.marinStart, andxAxis.tickeText.paddingBottomis changed toxAxis.tickeText.marginEnd.yAxis.heightis changed toyAxis.size,yAxis.tickeText.paddingTopis changed toyAxis.tickeText.marinStart, andyAxis.tickeText.paddingBottomis changed toyAxis.tickeText.marginEnd.technicalIndicator.baris changed toindicator.bars,technicalIndicator.lineis changed toindicator.linesīŧtechnicalIndicator.circleis changed toindicator.circles.- Delete
shape,annotation,tag, please useoverlayinstead.
API adjustment â
Chart API â
extension.addTechnicalIndicatorTemplate(template)is changed toregisterIndicator(template).- Delete
extension.addShapeTemplate(template), please useregisterOverlay(template)instead.
Instance API â
getDom({paneId, position})is changed togetDom(paneId, position), and the parameterpositionoption is changed toroot,mainandyAxis.getWidth()andgetHeight()are combined into a method 'getSize(paneId, position).setStyleOptions(styles)is changed tosetStyles(styles).getStyleOptions()is changed togetStyles().setOffsetRightSpace(space)is changed tosetOffsetRightDistance(distance).createTechnicalIndicator(value, isStack, paneOptions)is changed tocreateIndicator(value, isStack, paneOptions).overrideTechnicalIndicator(override, paneId)is changed tooverrideIndicator(override, paneId).getTechnicalIndicatorByPaneId(paneId, name)is changed togetIndicatorByPaneId(paneId, name).removeTechnicalIndicator(paneId, name)is changed toremoveIndicator(paneId, name).subscribeAction(type, callback)andunsubscribeAction(type, callback). The parametertypeoption is changed toonZoom,onScroll,onCrosshairChange,onVisibleRangeChangeandonPaneDrag.convertToPixel(value, finder)andconvertFromPixel(coordinate, finder), the parameterfinder.absoluteYAxisis changed tofinder.absolute.- To delete
createShape(value, paneId),createAnnotation(annotation, paneId),createTag(tag, paneId), please usecreateOverlay(value, paneId)instead. - To delete
removeShape(id),removeAnnotation(paneId, points),removeTag(paneId, tagId), please useremoveOverlay(id)instead. - To delete
setShapeOptions(options), useoverrideOverlay(override)instead. - To delete
createHtml(html, paneId),removeHtml(paneId, htmlId), please obtain the corresponding dom throughgetDom(paneId, position). - To delete
getTechnicalIndicatorByPaneId(paneId, name).
Shape help API â
- All APIs are migrated to 'klinecharts.utils'.
Customized technical indicator adjustment â
- Attribute
plotsis changed tofigures, sub item methodscolor,isStroke,isDashedare merged intostyles. - Change the method '
regeneratePlots(params)toregenerateFigures(params). - The method
calcTechnicalIndicator(kLineDataList, options)is changed tocalc(kLineDataList, indicator). - The method
createTooltipDataSource({ dataSource, viewport, crosshair, technicalIndicator, xAxis, yAxis, defaultStyles })is changed tocreateTooltipDataSource({ kLineDataList, indicator, visibleRange, bounding, crosshair, defaultStyles, xAxis, yAxis }). The return value is determined by[{ title: 'xxx', value: 'xxx', color: 'xxx' } ]Change to{ name: 'xxx', calcParamsText: 'xxx', values: [{ title: 'xxx', value: 'xxx', color: 'xxx' }, ...] }. - The method
render({ctx, dataSource, viewport, styles, xAxis, yAxis})is changed todraw({ ctx, kLineDataList, indicator, visibleRange, bounding, barSpace, defaultStyles, xAxis, yAxis }). - Delete the attribute
shouldCheckParamCount.