All Projects → gribnoysup → Wunderbar

gribnoysup / Wunderbar

Licence: mit
Simple horizontal bar chart printer for your terminal

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Wunderbar

Python Progressbar
Progressbar 2 - A progress bar for Python 2 and Python 3 - "pip install progressbar2"
Stars: ✭ 682 (+19.23%)
Mutual labels:  cli, terminal, library, bar
Tabulate
Table Maker for Modern C++
Stars: ✭ 862 (+50.7%)
Mutual labels:  cli, terminal, library
Unix Permissions
Swiss Army knife for Unix permissions
Stars: ✭ 106 (-81.47%)
Mutual labels:  cli, terminal, library
Alive Progress
A new kind of Progress Bar, with real-time throughput, ETA, and very cool animations!
Stars: ✭ 2,940 (+413.99%)
Mutual labels:  cli, terminal, bar
Ervy
Bring charts to terminal.
Stars: ✭ 1,530 (+167.48%)
Mutual labels:  cli, terminal, chart
Typin
Declarative framework for interactive CLI applications
Stars: ✭ 126 (-77.97%)
Mutual labels:  cli, terminal, library
Nve
Run any command on specific Node.js versions
Stars: ✭ 531 (-7.17%)
Mutual labels:  cli, terminal, library
Pulsemixer
CLI and curses mixer for PulseAudio
Stars: ✭ 441 (-22.9%)
Mutual labels:  cli, terminal
Hn Cli
📰 CLI to browse Hacker News
Stars: ✭ 448 (-21.68%)
Mutual labels:  cli, terminal
Ferret
Declarative web scraping
Stars: ✭ 4,837 (+745.63%)
Mutual labels:  cli, library
Saws
A supercharged AWS command line interface (CLI).
Stars: ✭ 4,886 (+754.2%)
Mutual labels:  cli, terminal
Spotify Cli Linux
🎶 A command line interface to Spotify on Linux
Stars: ✭ 443 (-22.55%)
Mutual labels:  cli, terminal
Create React Library
⚡CLI for creating reusable react libraries.
Stars: ✭ 4,554 (+696.15%)
Mutual labels:  cli, library
Bubbles
TUI components for Bubble Tea 🍡
Stars: ✭ 467 (-18.36%)
Mutual labels:  cli, terminal
Dstask
Single binary terminal-based TODO manager with git-based sync + markdown notes per task
Stars: ✭ 431 (-24.65%)
Mutual labels:  cli, terminal
Whipper
Python CD-DA ripper preferring accuracy over speed
Stars: ✭ 517 (-9.62%)
Mutual labels:  cli, terminal
Vue Bar
Simple, elegant spark bars for Vue.js
Stars: ✭ 414 (-27.62%)
Mutual labels:  chart, bar
Instapy Cli
✨ Python library and CLI to upload photo and video on Instagram. W/o a phone!
Stars: ✭ 498 (-12.94%)
Mutual labels:  cli, library
World Cup 2018 Cli Dashboard
⚽🏆A World Cup 2018 CLI dashboard – Watch matches in your terminal
Stars: ✭ 529 (-7.52%)
Mutual labels:  cli, terminal
Typer
Typer, build great CLIs. Easy to code. Based on Python type hints.
Stars: ✭ 6,793 (+1087.59%)
Mutual labels:  cli, terminal

@gribnoysup/wunderbar

Have you ever wanted to print some pretty bar charts in your terminal? You are in the right place!

wunder-bar-cli-all

Wunderbar can print horisontal bar chart with legend and chart scale straight to your terminal. Or you can use it as a module in your code and get all the building blocks to print chart yourself.

Wunderbar uses partial block characters (▏▎▍▌▋▊▉█) to print the most precise charts possible:

wunder-bar-precise

Use in terminal

echo "[1, 2, 3, 4, 5]" | npx @gribnoysup/wunderbar --min 0

wunder-bar-echo-json

cat data.json | npx @gribnoysup/wunderbar --min 0

wunder-bar-cat-file

Use in your code

npm i --save @gribnoysup/wunderbar
const wunderbar = require('@gribnoysup/wunderbar');
const data = require('./data.json');

const printData = () => {
  const { chart, legend, scale, __raw } = wunderbar(data, {
    min: 0,
    length: 42,
  });

  console.log();
  console.log(chart);
  console.log();
  console.log(scale);
  console.log();
};

printData();

Limitations

  • Wunderbar supports only node >= 6

  • Wunderbar uses chalk.hex to add color to your charts. Chalk is pretty smart to downgrade the color if it is not supported by your terminal, but output may vary in different terminals.

API

wunderbar(values, [options]) ⇒ OutputValue

Param Type Default Description
values Array<InputValue> Values to draw on a chart
[options] Object Chart drawing options
[options.min] number min value from values Min chart value (inclusive)
[options.max] number max value from values Max chart value (inclusive)
[options.length] number terminal width Chart length
[options.sort] "min" | "max" | "none" | (a: NormalizedValue, b: NormalizedValue) => number "none" Sort method for chart values
[options.randomColorOptions] Object {} randomColor options for color generation
[options.format] string | (a: number) => string "0.00" Value format method. String values are Numeral.js format strings

All options are also supported in the cli version:

echo "[1000, 3000, 5000, 7000, 9000, 11000]" | \
  npx @gribnoysup/wunderbar --min 0 --max 15000 --length 42 --sort min --randomColorOptions '{ "seed": "unicorn" }' --format "0a"

wunder-bar-cli-all

Types

InputValue : { value: number, color?: string, label?: string } | number | string

OutputValue : { legend: string, scale: string, chart: string, __raw: RawData }

RawData : { chartLength: number, minValue: number, minValueFormatted: string, maxValue: number, maxValueFormatted: string, normalizedValues: NormalizedValue[] }

NormalizedValue : { normalizedValue: number, rawValue: number, formattedValue: string, color: string, label: string, lineLength: number, chartBar: string, coloredChartBar: string }

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].