Skip to content

Repository files navigation

chartex

chartex Logo

You don't need to leave the terminal to visualize your dataset.

npm version Node.js License ReScript

Overview

chartex renders compact, beautiful ASCII charts for terminals and scripts from plain JSON/NDJSON/CSV input or a CLI. It is written in ReScript and shipped as a tiny ESM library so you can embed charts in scripts.

Quick highlights

  • Small, zero-dependency renderers: Bar, Bullet, Scatter, Sparkline, Pie/Donut/Gauge available in the library.
    • Bar chart
    • Bullet chart
    • Scatter chart
    • Sparkline chart
    • Pie, Donut, Gauge chart
  • Works with any data shape via accessor-based configs (no pre-transforms required).
  • Includes a CLI for piping data-in → ASCII chart-out.
  • Thoroughly tested ReScript core with JavaScript-compatible build artifacts.

Note

Requirements: Node.js 22+

Quick Install

npm install chartex

Usage

Build your first chart with the library

  1. Create a file example.mjs and paste:
import { Bar } from "chartex";

const data = [
  { name: "Jan", total: 45 },
  { name: "Feb", total: 67 },
  { name: "Mar", total: 82 },
];

const chart = Bar.make(data, {
  key: (d) => d.name,
  value: (d) => d.total,
  style: (d) => (d.total > 60 ? "█" : "░"),
}, { height: 10 });

console.log(chart);
  1. Run it:
node example.mjs

CLI

You can install the CLI globally or use npx to run it without installing:

Global install

npm install -g chartex

No-install usage

Basic usage:

npx chartex [options] [file]

Note

Full CLI options reference: docs/cli.md

Documentation

📖 Full docs at metalbolicx.github.io/chartex

Contributing

Contributions welcome — open issues or PRs.

npm run res:build   # compile ReScript
npm run res:test    # run tests
npm run cli:build   # bundle CLI (if CLI changed)
npm run build       # build dist/ artifacts (tsdown)
npm run res:clean   # clean ReScript outputs

License

Released under MIT by @MetalbolicX.

About

A blend of "chart" and "text,". No pixels? No problem. ASCII charts are here to visualize your data.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages