/klineweb

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

Primary LanguageJavaScriptMIT LicenseMIT

KLineChart

npm version Build Status Codacy Badge size types License

📈A kline library for browser. Support technical indicators, drawing marker maps and 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

var chart = klinecharts.init(document.getElementById('div'))
chart.setConfig(config)
chart.setMainIndicatorType(indicatorType)
chart.setSubIndicatorType(indicatorType)
chart.showVolChart(true)
chart.setDefaultRange(range)
chart.setMinRange(range)
chart.setMaxRange(range)
chart.addData(dataList, pos)
chart.getDataList()
chart.getMainIndicatorType()
chart.getSubIndicatorType()
chart.getConfig()
chart.isShowVolChart()
chart.clearData()
chart.getConvertPictureUrl()
chart.drawMarker(markerType)
chart.clearAllMarker()

Data Source

Data source requires KLineData array.

The single data format is as follows:

{ open, close, high, low, volume, turnover, timestamp }

Config

Config is used to configure the style of the chart. Here is the details.

Technical Indicators

MA VOL MACD BOLL KDJ RSI BIAS BRAR CCI DMI
✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅
CR PSY DMA TRIX OBV VR WR MTM SAR
✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅

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.