Ascii bar charting for nodejs
JavaScript
Latest commit c74a0e5 Mar 25, 2014 @tj tj Release 1.2.2
Permalink
Failed to load latest commit information.
examples add value mapping support Feb 27, 2014
.gitignore initial implementation Feb 27, 2014
History.md Release 1.2.2 Mar 25, 2014
Makefile Initial commit Feb 27, 2014
Readme.md rename. Closes #1 Mar 25, 2014
index.js fix issue with max 0. Closes #2 Feb 28, 2014
package.json Release 1.2.2 Mar 25, 2014

Readme.md

Bars

Ascii bar charting for node.

     cats | ########################                                     | 6
  ferrets | ############################################################ | 15
     dogs | ########                                                     | 2
   koalas |                                                              | 0


     dogs | ==================== | 30
  ferrets | =============        | 20
     cats | ========             | 12
   koalas | ==                   | 3


  /data | ******************** | 150gb
   /srv | *                    | 5gb
   /etc |                      | 150mb

Installation

$ npm install jstrace/bars

Example

var bars = require('bars');
var bytes = require('bytes');

var data = {
  cats: 6,
  ferrets: 15,
  dogs: 2,
  koalas: 0
};

console.log();
console.log(bars(data));

// customized

var data = {
  ferrets: 20,
  cats: 12,
  dogs: 30,
  koalas: 3
};

console.log();
console.log(bars(data, { bar: '=', width: 20, sort: true }));

// value mapping

var data = {
  '/srv': bytes('5gb'),
  '/data': bytes('150gb'),
  '/etc': bytes('150mb')
};

console.log();
console.log(bars(data, { bar: '*', width: 20, sort: true, map: bytes }));

License

MIT