sparkly

Generate sparklines ▁▂▃▅▂▇

  • Owner: sindresorhus/sparkly
  • Platform:
  • License:: MIT License
  • Category::
  • Topic:
  • Like:
    0
      Compare:

Github stars Tracking Chart

sparkly Build Status

Generate sparklines ▁▂▃▅▂▇

JavaScript port of spark.sh.

Some cool use-cases.

Install

$ npm install 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 an object with minimum and maximum options will change the sparkline range
sparkly([1, 2, 3, 4, 5], {minimum: 0, maximum: 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: number[]

Numbers to create the sparkline from.

options

Type: object

minimum

Type: number

Minimum range.

maximum

Type: number

Maximum range.

style

Type: string
Values: 'fire'

Style for the sparklines.

License

MIT © Sindre Sorhus

Main metrics

Overview
Name With Ownersindresorhus/sparkly
Primary LanguageJavaScript
Program languageJavaScript (Language Count: 2)
Platform
License:MIT License
所有者活动
Created At2014-08-27 21:25:19
Pushed At2021-11-21 08:01:52
Last Commit At
Release Count10
Last Release Namev6.0.0 (Posted on 2021-11-21 14:54:27)
First Release Namev1.0.0 (Posted on 2014-08-27 23:29:18)
用户参与
Stargazers Count424
Watchers Count11
Fork Count12
Commits Count35
Has Issues Enabled
Issues Count8
Issue Open Count1
Pull Requests Count5
Pull Requests Open Count0
Pull Requests Close Count3
项目设置
Has Wiki Enabled
Is Archived
Is Fork
Is Locked
Is Mirror
Is Private