c0bra / terminal-treemap

Create a treemap (binpacked rectangles in a box) in the terminal

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

terminal-treemap Build Status codecov

Treemaps in the terminal

Install

$ npm install --save terminal-treemap

Usage

const terminalTreemap = require('terminal-treemap');

const data = [
	{ content: 'Foo\n250kb', value: 50 },
	{ content: 'Bar\n150kb', value: 25 },
	{ content: 'Baz\n150kb', value: 5 },
	{ content: 'Baz\n150kb', value: 5 },
];

const output = terminalTreemap(data);
console.log(output);

Example

API

terminalTreemap(input)

Input should be an array of objects where each object has a content prop and a value prop. The value property will be used to ratio the size of the boxes in the terminal.

Thanks

Inspiration from boxen by Sindre.

License

MIT © Brian Hann

About

Create a treemap (binpacked rectangles in a box) in the terminal

License:MIT License


Languages

Language:JavaScript 100.0%