npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

zibar

v1.0.15

Published

Pretty graphs for the terminal

Downloads

842

Readme

Zibar

Pretty graphs for the terminal

screenshot from 2016-01-12 21 48 11

Inspired from babar and sparkline. This actually mixes features of both.

Installation

npm install zibar -g

If you don't know what npm is, read this.

Usage

zibar [-c config-file] [ - ] [ value1 [value2..]]

Data can be read from stdin

screenshot from 2016-01-12 21 45 55

Configuration allows fancy rendering

screenshot from 2016-01-12 21 48 51

{
  "height": 5,
  "min": 0,
  "high": 40,
  "marks": [ 0, "?", 0, 0, { "symbol": "▼", "color": "red,bold" } ],
  "color": "green",
  "colors": {
    "5": "magenta,bold"
  },
  "vlines": [null, null, "cyan"],
  "yAxis": {
    "decimals": 0
  },
  "xAxis": {
    "interval": 2,
    "color": "yellow,bold"
  }
}

Or minimal sparkline style

screenshot from 2016-01-12 21 59 47

{
  "height": 1,
  "min": 0,
  "color": "yellow,bold",
  "yAxis": {
    "display": false
  },
  "xAxis": {
    "display": false
  }
}

Configuration

{
  "height": 5,                 // graph height
  "color": "green",            // bar color
  "background": "blue",        // graph background color
  "min": 0,                    // minimum value, clips values below
  "max": 10,                   // maximum value, clips values above
  "low": 3,                    // soft minimum, values below are also shown
  "high": 6.                   // soft maximum, values above are also shown
  "chars": " ⡀⡀⡄⡄⡆⡆⡇⡇⡇",     // characters used for the bars, defaults to unicode block elements
  "marks": [ 0,                // markers chars above the graph
            "?",               // can be an array or integer-indexed object
            null,
            0,
            { "symbol": "▼",   // use objects to add styling
              "color": "red" }
            ],
  "colors": {                  // custom colors for values
    "5": "magenta,bold"        // can be an array or integer-indexed object
  },
  "vlines":
    [null, null, "cyan"],      // vertical lines markers
  "yAxis": {
    "display": true,           // show/hide the axis labels
    "color": "yellow",         // axis label color
    "ticks": true,             // show/hide axis ticks
    "decimals": 0              // number of decimals in axis labels
  },
  "xAxis": {
    "display": true,           // show/hide the axis labels
    "color": "yellow",         // axis label color
    "interval": 2,             // distance between labels
    "origin": 10,              // axis scale starts with this value
    "factor": 2,               // axis scale multiplier
    "offset": 3                // relative position of the label to its default
  }
}

Rendering glitches

The terminal and its font must support unicode. Ensure you have one, e.g. Source Code Pro.

If some blocks looks weird, try the following config options.

"badBlock": true,
"fixFull": true

Using as a library

npm install zibar --save
var zibar = require('zibar');
var graph = zibar(data, config);  // returns the graph as a string

Example

var graph = zibar([30, 12, 9.8, 31, 14, 31.5, 4, 6, 22, 33, 4, 22],
                  {
                    "height": 1,
                    "min": 0,
                    "color": "yellow,bold",
                    "yAxis": {
                      "display": false
                    },
                    "xAxis": {
                      "display": false
                    }
                  });
process.stdout.write(graph);

Formatting

When using as a library, you can pass a function for formatting x and y axis labels.

format: function(x) { return require('roman-numerals').toRoman(x); }

Scale Transform

For non-linear y scale, you can pass a function and its inverse to transform the scale.

tranform: function(x) { return Math.log(x)/Math.log(10); }
inverse: function(x) { return Math.pow(10,x); }