asciichart
A zero-dependency library for rendering line charts as plain ASCII/ANSI text in the console or terminal
Repository Health
Technical Analysis
asciichart renders numeric series as line charts made entirely of ASCII/box-drawing characters, so you can visualize data directly in a terminal, log file, or console output without a browser, canvas, or graphics dependency. A single plot() call takes an array of numbers and returns a multi-line string ready to print.
It supports multiple overlaid series, configurable height and value-label formatting, ANSI color output, and padding/offset controls, and ships both a JavaScript (Node.js/browser) implementation and a companion Python port (asciichartpy) from the same repository.
What You Get
- A
plot(series, config)function that renders one or more numeric arrays as an ASCII line chart string - Support for multiple overlaid series with distinct ANSI colors for comparison charts
- Configurable chart height, value-axis label formatting, and horizontal offset/padding
- Zero runtime dependencies, usable in Node.js, browsers, or any JS runtime that can print strings
- A companion Python implementation (
asciichartpy) maintained in the same repository for cross-language use
Common Use Cases
- Visualizing metrics or numeric trends directly in CLI tool output without a GUI or browser
- Logging sparkline-style charts to server logs for quick trend inspection during debugging
- Building lightweight terminal dashboards (system monitors, trading tools, build-time reports) with inline charts
- Rendering quick data visualizations in constrained environments (SSH sessions, CI logs) where graphical charts aren’t viewable
Under The Hood
Architecture: The entire library lives in a single file, asciichart.js (~110 lines), which implements one core plot() function that computes the chart’s numeric range, builds a 2D character grid sized to the requested height, and walks each data series drawing box-drawing characters (┈, ╭, ╯, etc.) at the correct grid positions before joining rows into the final string. Tech Stack: Plain vanilla JavaScript with no runtime dependencies, distributed as a CommonJS module (main: asciichart.js) usable directly in Node.js or bundled for browsers; devDependencies include mocha/nyc/istanbul for testing and coverage, and eslint for linting. Code Quality: test.js exercises the plotting function against expected ASCII output strings for various configurations (single/multi-series, custom height, offsets); the codebase is intentionally minimal and has changed little in recent years, reflecting a stable, feature-complete single-purpose utility. API Design: The API is a single function call (asciichart.plot(series, { height, colors, format })) with no setup or class instantiation required, making it about as low-friction as a charting library can be, though customization is limited to the documented config keys rather than a full theming system.