项目作者: AD-feiben

项目描述 :
a lightweight chart implemented by canvas.
高级语言: TypeScript
项目地址: git://github.com/AD-feiben/lw-chart.git
创建时间: 2020-05-05T17:33:17Z
项目社区:https://github.com/AD-feiben/lw-chart

开源协议:MIT License

下载



lw-chart

lw-chart

A lightweight chart implemented by canvas.



license

Install

  1. $ npm i lw-chart

Usage

  1. // import { Area } from 'lw-chart';
  2. import Area from 'lw-chart/dist/Area.js';
  3. const xAxisData = [ '5-01', '5-02', '5-03', '5-04', '5-05', '5-06', '5-07' ];
  4. const yAxisData = [ [ 2, 5, 7, 10, 6, 8, 12 ] ];
  5. const baseConfig = {
  6. title: 'Line Mode',
  7. canvasPadding: [10, 30, 10, 20],
  8. chartPadding: [10],
  9. canvasBg: '#f2f2f2',
  10. chartBg: '#fff',
  11. areaLineColor: ['rgba(255, 71, 87,1.0)'],
  12. areaDotStorkColor: ['rgba(255, 71, 87,1.0)'],
  13. areaActiveDotFillColor: ['rgba(255, 71, 87,.3)'],
  14. areaStartColor: ['rgba(0, 0, 0, 0)'],
  15. areaEndColor: ['rgba(0, 0, 0, 0)'],
  16. yAxisFormat: (val) => {
  17. return val.toFixed(2);
  18. }
  19. };
  20. const lineChart = new Area(document.querySelector('.line-chart'), baseConfig);
  21. lineChart.updateData(xAxisData, yAxisData);

Document

Document

Demo

Demo

Official Account

微信公众号【前端develop】

前端develop