Asciichart
Nice-looking lightweight console ASCII line charts, using C++, no dependencies.
Install / Use
/learn @Civitasv/AsciichartREADME
asciichart
A port of the npm package asciichart by Igor Kroitor.
Just used to plot ascii line charts, no dependencies.

Usage
This is a header only library, you can copy all files in include directory to your project.
Options
The width of the chart equals to the length of data series. The height and range will be determined automatically. Users can specify:
- height: height of chart.
- offset: axis offset from the left (min 2).
- colors: colors used in chart.
- min: min value.
- max: max value.
- symbols: symbols used in chart.
- TODO type: type of chart, LINE, CIRCLE.
Examples
Scale to Desired height
std::vector<double> series; // range from -15 to +15
for (int i = 0; i < 200; i += 2)
{
series.push_back(15 * std::cos(i * (kPI * 8) / 120));
}
Asciichart asciichart(std::vector<std::vector<double>>{series});
std::cout << '\n'
<< asciichart.height(10).Plot() // rescale to -3 ~ +3 lines
<< '\n';

Multiple Series
std::vector<double> series;
for (int i = 0; i < 200; i += 2)
{
series.push_back(15 * std::cos(i * (kPI * 8) / 120));
}
std::vector<double> series2;
for (int i = 0; i < 200; i += 2)
{
series2.push_back(15 * std::sin(i * ((kPI * 4) / 100)));
}
Asciichart asciichart(std::vector<std::vector<double>>{series, series2});
std::cout << '\n'
<< asciichart.height(6).Plot()
<< '\n';

Now it support Legend
void example_legend2() {
using namespace ascii;
std::vector<double> series;
std::vector<double> series2;
for (int i = 0; i < 100; i += 2) {
series.push_back(15 * std::cos(i * (kPI * 8) / 120));
series2.push_back(15 * std::sin(i * ((kPI * 4) / 100)));
}
Asciichart asciichart({{"A", series}, {"B", series2}});
std::cout << asciichart.show_legend(true).height(6).Plot();
}

Animation
std::vector<double> series;
std::vector<double> series2;
int height = 6;
for (int i = 0; i < 100; i += 2) {
series.push_back(15 * std::cos(i * (kPI * 8) / 120));
series2.push_back(15 * std::sin(i * ((kPI * 4) / 100)));
Asciichart asciichart(std::vector<std::vector<double>>{series, series2});
if (i != 0) {
for (int j = 0; j <= height; j++) {
std::cout << "\033[A\033[2K";
}
std::this_thread::sleep_for(std::chrono::milliseconds(500));
}
std::cout << asciichart.height(height).Plot();
}

Related Skills
node-connect
333.3kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
82.0kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
333.3kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
commit-push-pr
82.0kCommit, push, and open a PR
