Skip to content

📈A kline library for browser. Zero dependencies. Support mobile.

License

Notifications You must be signed in to change notification settings

stock-chart/klineweb

 
 

Repository files navigation

KLineChart(English|中文)

npm version Build Status Codacy Badge size types License

📈A kline library for browser. Support technical indicators and parameter setting, support drawing marker maps, custom styles.

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('div'))
klinecharts.version()

klinecharts instance

resize()
setStyle(style)
getStyle()
setMainChartType(chartType)
setIndicatorParams(indicatorType, params)
getIndicatorParams(indicatorType)
setMainIndicatorType(indicatorType)
getMainIndicatorType()
setSubIndicatorType(indicatorType)
getSubIndicatorType()
showVolChart(true)
isShowVolChart()
setDefaultRange(range)
setMinRange(range)
setMaxRange(range)
addData(dataList, pos, noMore)
getDataList()
clearData()
drawMarker(markerType)
clearAllMarker()
loadMore((timestamp) => {})
getConvertPictureUrl()

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]

Marker Maps

Does not support mobile.

  • 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

License

Copyright (c) 2019 lihu

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

About

📈A kline library for browser. Zero dependencies. Support mobile.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%