histo

0.0.1 • Public • Published

node-histo

install

$ npm install histo

usage

All Histo instances are Writable streams. Only one histo stream may be enabled at a time. You can swap between histo streams with #enable() which will clean up the terminal view and render the enabled histo stream.

The following program:

var histo = require('histo');
 
var a = histo();
 
a.enable();
setInterval(function () {
  a.write(Math.random() * 1000);
}, 100);

Could yield something like this:

                                 █
 973 ․                           █
                                 █   █
 917 ․   █                       █   █
         █                       █   █
 862 ․   █ █                     █   █
         █ █                     █   █
 806 ․   █ █                     █   █
         █ █                     █   █
 751 ․   █ █                     █   █
         █ █ █                   █   █
 695 ․   █ █ █           █       █   █
         █ █ █           █       █   █
 639 ․   █ █ █ █         █       █   █
         █ █ █ █         █       █   █
 584 ․   █ █ █ █         █       █   █
         █ █ █ █         █       █   █
 528 ․   █ █ █ █       █ █       █   █
         █ █ █ █       █ █       █   █
 473 ․   █ █ █ █     █ █ █     █ █   █
         █ █ █ █     █ █ █     █ █   █
 417 ․   █ █ █ █     █ █ █     █ █   █
         █ █ █ █     █ █ █     █ █   █
 361 ․   █ █ █ █     █ █ █     █ █   █
         █ █ █ █     █ █ █     █ █   █
 306 ․   █ █ █ █     █ █ █     █ █   █
         █ █ █ █     █ █ █     █ █   █
 250 ․   █ █ █ █     █ █ █     █ █ █ █ █
         █ █ █ █     █ █ █     █ █ █ █ █
 195 ․   █ █ █ █     █ █ █ █   █ █ █ █ █
         █ █ █ █   █ █ █ █ █   █ █ █ █ █
 139 ․   █ █ █ █   █ █ █ █ █   █ █ █ █ █
         █ █ █ █ █ █ █ █ █ █   █ █ █ █ █
  83 ․   █ █ █ █ █ █ █ █ █ █   █ █ █ █ █
         █ █ █ █ █ █ █ █ █ █   █ █ █ █ █
  28 ․   █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █
         ․ ․ ․ ․ ․ ․ ․ ․ ․ ․ ․ ․ ․ ․ ․ ․ ․ ․ ․ ․ ․ ․ ․ ․ ․ ․ ․ ․ ․ ․ ․ ․

api

Same as through

All control flow can be controlled with .pause() and .resume(). To enable into view, use .enable().

histo(values)

  • values - An array of initial values to be wrtten to the stream
var h = histo([19, 45, 4, 65]);

#enable

Enable the stream to be rendered into view.

h.enable();

license

MIT

Dependents (1)

Package Sidebar

Install

npm i histo

Weekly Downloads

4

Version

0.0.1

License

MIT

Last publish

Collaborators

  • werle