KLineChart(English|中文)
📈Lightweight k-line chart built with html5 canvas. Support technical indicator and parameter setting, support for graphic markup, custom style.
The chart is based on canvas. In theory, as long as it supports canvas, it is the same on mobile.
Using npm:
$ npm install klinecharts
Using yarn:
$ yarn add klinecharts
klinecharts.init(document.getElementById('divDomId'))
klinecharts.dispose(document.getElementById('divDomId'))
klinecharts.version()
setStyleOptions(options)
getStyleOptions()
setTechnicalIndicatorParams(technicalIndicatorType, params)
getTechnicalIndicatorParamOptions()
setPrecision(pricePrecision, volumePrecision)
setTimezone(timezone)
resize()
setOffsetRightSpace(space)
setDataSpace(space)
clearData()
getDataList()
applyNewData(dataList, more)
applyMoreData(dataList, more)
updateData(data)
loadMore(cb)
setCandleStickChartType(chartType)
setCandleStickTechnicalIndicatorType(technicalIndicatorType)
setTechnicalIndicatorType(tag, technicalIndicatorType)
addTechnicalIndicator(technicalIndicatorType, height)
removeTechnicalIndicator(tag)
addGraphicMark(graphicMarkType)
removeAllGraphicMark()
getConvertPictureUrl(includeFloatLayer, includeGraphicMark, type)
Data source requires KLineData array.
The single data format is as follows:
{ open, close, high, low, volume, turnover, timestamp }
Used to configure the style of the chart. Here is the details.
type | MA | VOL | MACD | BOLL | KDJ |
---|---|---|---|---|---|
params | [5,10,30,60] | [5,10,20] | [12,26,9] | [20] | [9,3,3] |
type | RSI | BIAS | BRAR | CCI | DMI |
params | [6,12,24] | [6,12,24] | [26] | [13] | [14,6] |
type | CR | PSY | DMA | TRIX | OBV |
params | [26,10,20,40,60] | [12] | [10,50,10] | [12,20] | [30] |
type | VR | WR | MTM | EMV | SAR |
params | [24,30] | [13,34,89] | [6,10] | [14,9] | [2,2,20] |
- Horizontal straight line
- Vertical straight line
- Straight line
- Parallel straight line
- Horizontal ray
- Vertical ray
- Ray
- Horizontal line segment
- Vertical line segment
- Line segment
- Price line
- Price channel line
- Fibonacci line
shift + ←
can be used to shift left.shift + →
can be used to shift right.shift + ↑
can be used to zoom out.shift + ↓
can be used to zoom in.