# cli-barchart

> fancy bar chart in your terminal

Latest version **0.2.3** (published 2021-10-13) · MIT license · 0 weekly downloads

## Install

```sh
npm install cli-barchart
pnpm add cli-barchart
yarn add cli-barchart
bun add cli-barchart
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.3 |
| Published | 2021-10-13 |
| First published | 2021-10-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 5 |
| Unpacked size | 17.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Maintainers | fengzilong |

## Links

- npm: https://www.npmjs.com/package/cli-barchart
- Repository: https://github.com/fengzilong/cli-barchart
- Homepage: https://github.com/fengzilong/cli-barchart#readme
- Issues: https://github.com/fengzilong/cli-barchart/issues
- npm.io page: https://npm.io/package/cli-barchart

## Dependencies (5)

- [chalk](https://npm.io/package/chalk.md) ^4.1.2
- [is-even](https://npm.io/package/is-even.md) ^1.0.0
- [term-size](https://npm.io/package/term-size.md) ^2.2.1
- [string-width](https://npm.io/package/string-width.md) ^4.2.3
- [@types/is-even](https://npm.io/package/@types/is-even.md) ^1.0.0

## Recent versions

- 0.2.3 (latest) — 2021-10-13
- 0.2.2 — 2021-10-13
- 0.2.1 — 2021-10-13
- 0.2.0 — 2021-10-13
- 0.1.0 — 2021-10-12

## README

# cli-barchart

Fancy and customizable bar chart in your terminal

<img src="media/blue.jpg" alt="screenshot-of-blue-bar" width="500" />

<img src="media/green.jpg" alt="screenshot-of-green-bar" width="500" />

# Installation

for npm users

```bash
npm i cli-barchart
```

for yarn users

```bash
yarn add cli-barchart
```

# Usage

```js
const bar = require( 'cli-barchart' )
const chalk = require( 'chalk' )

const chartString = bar.default( [
  {
    key: 'foo',
    value: 0.1,
  },
  {
    key: 'bar',
    value: 0.2
  },
  {
    key: 'longtext',
    value: 0.3
  }
], {
  // max width of bar, default is 1/3 of terminal columns
  maxWidth: 10,

  // bar color, default is blue
  colorize: ( item, index, items ) => chalk.green,

  // label after bar, default is percentage calculated from `item.value` / sum
  renderLabel: ( item, index, items ) => chalk.green( item.value ),
} )

console.log( chartString )
```

# License

MIT

---
_Source: https://npm.io/package/cli-barchart · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
