
Security News
High Salaries No Longer Enough to Attract Top Cybersecurity Talent
A survey of 500 cybersecurity pros reveals high pay isn't enough—lack of growth and flexibility is driving attrition and risking organizational security.
bar-horizontal
Advanced tools
Create beautiful horizontal charts, that fit your terminal.
$ npm install --save bar-horizontal
var barHorizontal = require('bar-horizontal');
barHorizontal([6, 5, 4, 3, 2]);
// => Prints this on the console :-
: ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 30%
: ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 25%
: ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 20%
: ▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 15%
: ▇▇▇▇▇▇▇▇▇ 10%
input_obj = {
'first task': 20,
'second task': 40,
'a really really long label!': 90,
'short one': 20
};
barHorizontal(input_obj, {labels: true});
// => Prints this on the console :-
first task : ▇▇▇▇ 12%
second task : ▇▇▇▇▇▇▇▇▇ 24%
a really really long label! : ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 53%
short one : ▇▇▇▇ 12%
$ npm install --global bar-horizontal
Create beautiful horizontal charts, that fit your terminal.
Usage
$ bar-horizontal input-array
$ bar-horizontal input-array --values
Examples
$ bar-horizontal 1 2 3 4
: ▇▇▇▇▇▇▇▇ 10%
: ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 20%
: ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 30%
: ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 40%
$ bar-horizontal 1 2 3 4 --ascii
: ====== 10.00%
: ============= 20.00%
: ==================== 30.00%
: =========================== 40.00%
Required
Type: Array of Numbers
The array whose bar chart will be created.
Optional
Type: Boolean
Default: false
Labels to be shown or not
Optional
Type: Boolean
Default: false
Whether or not to show warnings (eg. 'missing/invalid input')
Optional
Type: Boolean
Default: false
Whether or not to use the =
when printing the bar graph(s) to stdout.
By default, this module will use the square character from figures.
Optional
Type: Number
Default: The width of the present terminal
If supplied, the printed bar graph will look good on a terminal of the supplied
width's length.
Optional
Type: Boolean
Default: false
Whether barHorizontal
should print the results to the console or not. If
noPrint
is set, then the function will return the string and print nothing to
the console
This module uses the mocha test framework. The test suite can be run by invoking npm test
from the root directory.
MIT © Siddharth Kannan
FAQs
Create beautiful horizontal charts, that fit your terminal.
The npm package bar-horizontal receives a total of 6,781 weekly downloads. As such, bar-horizontal popularity was classified as popular.
We found that bar-horizontal demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
A survey of 500 cybersecurity pros reveals high pay isn't enough—lack of growth and flexibility is driving attrition and risking organizational security.
Product
Socket, the leader in open source security, is now available on Google Cloud Marketplace for simplified procurement and enhanced protection against supply chain attacks.
Security News
Corepack will be phased out from future Node.js releases following a TSC vote.