#bar-charts #visualization #console

bin+lib chart-relative

Compact bar charts in the terminal

2 releases

Uses new Rust 2024

0.1.1 Oct 2, 2025
0.1.0 Oct 2, 2025

#1676 in Command line utilities

Download history 107/week @ 2025-09-26 157/week @ 2025-10-03 16/week @ 2025-10-10 7/week @ 2025-10-17

287 downloads per month

MIT/Apache

35KB
514 lines

chart-relative

A library and CLI tool for generating compact text-based charts.

Crates.io Docs.rs CI

Why

I needed a simple way to visualize a small distribution of word counts and the effect of applying a filter.

Goals

  • Text output
  • Indicate outliers
  • Maximize information density

CLI

USAGE:
  chart-relative  [--max-height u16] [( --view-bottom | --view-top )]

  [--max-height u16]               Maximum number of lines to use for display before scaling. default: 16
  [( --view-bottom | --view-top )] Which end of range to show, if too large to show all. default: bottom


Standard Input:

    The standard input stream should contain 1-3 columns, separated by spaces.
    Input is truncated after 100 lines.

    Either:

    1. Only data
    integer

    2. Labeled data
    integer string

    3. Unlabeled comparison data
    integer integer

    4. Labeled comparison data
    integer integer string

Examples

echo "4 104 889 5517 22861 73805 184473 369441 599945 800265 881140 801904 600813 370368 185082 73635 23325 5399 931 95 4" | tr ' ' '\n' | chart-relative --view-top

bell.png

printf '%s\n' "4 1978" "104 3256" "889 5354" "5517 8789" "22861 14388" "73805 23449" "184473 37940" "369441 60686" "599945 95362" "800265 145940" "881140 215153" "801904 302032" "600813 400000" "370368 497967" "185082 584846" "73635 654059" "23325 704637" "5399 739313" "931 762059" "95 776550" "4 785611" | chart-relative --view-top

bell_logistic.png

More examples are available by running the tests. cargo test -- --nocapture

lowcharts can also be used to generate bar charts, and is more suitable for general purpose use. In contrast, chart-relative is useful for comparing two related data sets which may contain outliers.

Installation

Cargo

  • Install the rust toolchain in order to have cargo installed by following this guide.
  • run cargo install chart-relative

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

See CONTRIBUTING.md.

Dependencies

~2–12MB
~100K SLoC