JSPM

  • Created
  • Published
  • Downloads 386
  • Score
    100M100P100Q96082F
  • License MIT

simple ascii bar charts

Package Exports

  • chartscii

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (chartscii) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

chartscii

simple cli ascii bar charts

install

npm install chartscii

usage

chartscii accepts an array of data values, with optional labels, and outputs an ascii bar chart.

usage example:

const Chartscii = require('./index');

// generate random chart data
let count = 0;
const data = [];

for (let i = 1; i <= 10; i++) {
    data.push({ value: Math.floor(Math.random() * 6) + 1, label: `label_${count++}` });
}

// create chart
const chart = new Chartscii(data, {
    label: 'Example Chart',
    width: 500,
    sort: false,
    reverse: false,
    color: 'pink'
});

//print chart
console.log(chart.create());

outputs:

img

options

label (string)

a label for the chart. display in color if color: true;

width (number)

the width of the chart, scales values accordingly.

sort (boolean)

sort data.

reverse (boolean)

reverse chart values order.

color (string)

color bars in chart and label if provided.
can be one of:

  • green
  • red
  • pink
  • cyan
  • blue
  • yellow