https://github.com/c0bra/terminal-treemap
Create a treemap (binpacked rectangles in a box) in the terminal
https://github.com/c0bra/terminal-treemap
Last synced: 10 months ago
JSON representation
Create a treemap (binpacked rectangles in a box) in the terminal
- Host: GitHub
- URL: https://github.com/c0bra/terminal-treemap
- Owner: c0bra
- License: mit
- Created: 2018-11-09T17:11:48.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-01-02T22:15:26.000Z (over 7 years ago)
- Last Synced: 2025-02-14T02:56:04.157Z (over 1 year ago)
- Language: JavaScript
- Size: 17.6 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: readme.md
- License: license
Awesome Lists containing this project
README
# terminal-treemap [](https://travis-ci.org/c0bra/terminal-treemap) [](https://codecov.io/gh/c0bra/terminal-treemap?branch=master)
> Treemaps in the terminal
## Install
```
$ npm install --save terminal-treemap
```
## Usage
```js
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);
```

## 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](https://www.npmjs.com/package/boxen) by [Sindre](https://github.com/sindresorhus/sindresorhus).
## License
MIT © [Brian Hann](http://n/A)