Generate sparklines ▁▂▃▅▂▇
JavaScript
Clone or download
Latest commit 5f6c766 Dec 17, 2015
Permalink
Failed to load latest commit information.
.editorconfig extract CLI into a separate module Dec 6, 2015
.gitattributes init Aug 27, 2014
.gitignore init Aug 27, 2014
.travis.yml extract CLI into a separate module Dec 6, 2015
index.js fix dividing to zero Dec 17, 2015
license init Aug 27, 2014
package.json 3.1.2 Dec 17, 2015
readme.md cleanup #9 Dec 10, 2015
screenshot.png cleanup #9 Dec 10, 2015
test.js fix dividing to zero Dec 17, 2015

readme.md

sparkly Build Status

Generate sparklines ▁▂▃▅▂▇

JavaScript port of spark.sh.

Some cool use-cases.

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

License

MIT © Sindre Sorhus