0.1.2 • Published 3 years ago

bar-graphify v0.1.2

Weekly downloads
14
License
MIT
Repository
github
Last release
3 years ago

Bar Graphify

A simple and lightweight node module to create bar graphs as strings.

Installation

NPM :

npm install bar-graphify

Example usage:

const Graph = require('bar-graphify');
const options = {
    xLabels: ["X1", "X2", "X3"],
    yLabels: ["Y1", "Y2", "Y3"],
    fillChar: "▄",
    emptyChar: " ",
    cursorChar: "^",
    cursorLocation: 1,
    collumnWidth: 3,
    firstCollumnWidth: 4,
    collumnSeparator: " ",
    firstCollumnSeparator: "| ",
    fillHeights: [2, 1, 3]
}
const graph = new Graph(options);

console.log(graph.toString()); 

Console:

X3|         ▄▄▄
X2| ▄▄▄     ▄▄▄
X1| ▄▄▄ ▄▄▄ ▄▄▄
    Y1  Y2  Y3
    ^^

Methods:

setCursor()

Example:

graph.setCursor(3);

console.log(graph.toString()); 

Console:

X3|         ▄▄▄
X2| ▄▄▄     ▄▄▄
X1| ▄▄▄ ▄▄▄ ▄▄▄
    Y1  Y2  Y3
            ^^

setCollumnHeight()

Example:

graph.setCollumnHeight({ collumn: 2, height: 2 });

console.log(graph.toString()); 

Console:

X3|         ▄▄▄
X2| ▄▄▄ ▄▄▄ ▄▄▄
X1| ▄▄▄ ▄▄▄ ▄▄▄
    Y1  Y2  Y3
            ^^

Contributors

👤 TheStyxo

0.1.2

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago

0.0.9

3 years ago

0.0.8

3 years ago

0.0.7

3 years ago

0.0.6

3 years ago

0.0.5

3 years ago