Package Exports
- klinecharts
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (klinecharts) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
KLineChart(English|中文)
📈A kline library for browser. Support technical indicators and parameter setting, support for graphic markup, custom style.
Browser Support
The chart is based on canvas. In theory, as long as it supports canvas, it is the same on mobile.
Installing
Using npm:
$ npm install klinecharts
Using yarn:
$ yarn add klinecharts
API
klinecharts
klinecharts.init(document.getElementById('divDomId'))
klinecharts.dispose(document.getElementById('divDomId'))
klinecharts.version()
klinecharts instance
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
Data source requires KLineData array.
The single data format is as follows:
{ open, close, high, low, volume, turnover, timestamp }
Style Config
Used to configure the style of the chart. Here is the details.
Technical Indicators
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] |
Graphic Mark
- 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
Samples
https://liihuu.github.io/kline