char-charts

ES6 character based charting library

Usage no npm install needed!

<script type="module">
  import charCharts from 'https://cdn.skypack.dev/char-charts';
</script>

README

Char Charts

ES6 character based charting library

npm build coverage deps size vulnerabilities license


Installation

npm install char-charts
  • If using Babel, requires Babel 7.2+


About

Seems to work well with the font Consolas. I haven't tried many others yet.


Functions

barChart([settings])Array

Builds a bar chart.

               Test chart
  ╭──────┬───────┬──────┬───────┬──────╮
A ▐████████████████████████████ ╵77.63 │
B ▐█▌97.00▐███████████████████████████▌│
C ▐███▌  13.00   ╵      ╵       ╵      │
D ┃  0.15╵       ╵      ╵       ╵      │
E ▐▌  2.00       ╵      ╵       ╵      │
  ╰──────┴───────┴──────┴───────┴──────╯
  0     20      40     60      80    100
                    Hz
boxChart([settings])Array

Builds a box and whisker chart.

               Test chart
  ╭──────┬───────┬──────┬───────┬──────╮
A │      ·       ╵  ┣━━━━━━━▒▒▒▒▒▒▒▒▓━┫│
B │    ╭─ M: 13.00      ╵M: 90.00 ─╯  ▒▓
C ┣━▒▒▒▓▓▓━┫     ╵      ╵   M: 97.00 ─╯│
D ▒ ── M: 0.15   ╵      ╵       ╵      │
E ┃ ── M: 2.00   ╵      ╵       ╵      │
  ╰──────┴───────┴──────┴───────┴──────╯
  0     20      40     60      80    100
                    Hz