sparkly - 生成微线图 ▁▂▃▅▂▇
sparkly - 生成微线图 ▁▂▃▅▂▇
Node.js 命令行实用程序
共353Star
详细介绍
Generate sparklines ▁▂▃▅▂▇
JavaScript port of spark.sh.
Install
$ npm install --save sparkly
Usage
const sparkly = require('sparkly');
sparkly([0, 3, 5, 8, 4, 3, 4, 10]);
//=> '▁▃▄▇▄▃▄█'
// specifying anything other than finite numbers will cause holes
sparkly([0, 3, 5, '', 4, 3, 4, 10]);
//=> '▁▃▄ ▄▃▄█'
// specifying a min max object will change the sparkline range
sparkly([1, 2, 3, 4, 5], {min: 0, max: 10});
//=> '▁▂▃▄▄'
// specifying a style option will change the sparkline color
sparkly([1, 2, 3, 4, 5, 6, 7, 8], {style: 'fire'});
// ↓
API
sparkly(numbers, [options])
numbers
Type: array
of number
Numbers to create the sparkline from.
options
min
Type: number
Minimum range.
max
Type: number
Maximum range.
style
Type: string
Values: 'fire'
Style for the sparklines.
Related
- sparkly-cli - CLI for this module
License
MIT © Sindre Sorhus
-
153 Star
-
234 Star
-
330 Star
-
333 Star
-
0 Star
-
310 Star
-
0 Star
-
0 Star
-
11038 Star
-
0 Star