Summary
Charta is a command-line tool written in Go for generating colorful terminal graphs from data files or stdin input. It supports multiple graph types (Simple, MinMax, Compare, and Cumul) and various input formats including JSON, YAML, and plain text. Charta provides flexible input options, colorful output with customizable colors and label colors, grouping capabilities for data analysis, threshold support with warning and alert levels, and support for negative values. Perfect for data visualization in terminal environments and shell scripting workflows.
Features
Multiple Graph Types
Simple value graphs, Min/Max/Average graphs, Comparison graphs for side-by-side values, and Cumulative graphs for stacked segments.
Flexible Input
Support for JSON, YAML, TXT files, or stdin input for maximum flexibility.
Colorful Output
Terminal-based graphs with customizable graph colors and label colors (red, green, yellow, blue, magenta, cyan, grey, orange*, purple*).
*: only for Truecolor Terminals
Data Grouping
Group multiple values for averaging or analysis with configurable grouping options.
Threshold Support
Warning and alert thresholds with color coding for monitoring and alerting.
Customizable Display
Adjustable width, min/max values, labels, graph colors, label colors, and titles for personalized visualization. Support for negative values with proper scaling.
Easy Integration
Perfect for shell scripts, monitoring systems, and data analysis pipelines.
Installation Charta
Requirements
Go 1.24.6 or later
Distribution packages
Manual installation
$ # Build from source: $ git clone https://codeberg.org/spn109/charta.git $ go build -o charta $ # Make executable and install: $ chmod +x charta $ sudo mv charta /usr/local/bin/ $ # Or install directly with go: $ go install codeberg.org/spn109/charta@latest
Usage - Charta
Basic Command Structure
$ charta <graph-type> [graph-options] [values...]
Graph Types
Simple Graph
Displays a single value as a horizontal bar graph:
$ charta simple 75 $ charta simple --min 0 --max 100 --label "Utilisation CPU" 85
MinMax Graph
Displays minimum, average, and maximum values from a dataset:
$ ./charta minmax 10 20 30 40 50 $ ./charta minmax --label "Temps de Réponse" 120 150 180 200 175
Compare Graph
Displays two values side-by-side for direct comparison:
$ ccharta compare -B sum -b 1 -M 2300 -t "Pyramide des âges en France en 2018" --legend "Femmes (par milliers)" --legend2 "Hommes (par milliers)" --color "light-red" --color2 "blue" -b 5 -f Age2.txt
Cumul Graph
Displays multiple values as stacked colored segments in a single cumulative bar:
$ charta compare -B sum -b 1 -M 2300 -t "Pyramide des âges en France en 2018" --legend "Femmes (par milliers)" --legend2 "Hommes (par milliers)" --color "light-red" --color2 "blue" -b 5 -f Age2.txt
Global Options
-f, --file <file>: Input file (JSON, YAML, TXT) or "stdin"-H, --help_for_file <type>: Display formatted help for file type (txt, json, yaml)-G, --groupby <n>: Group N values together (default: 1)-m, --min <value>: Minimum scale value (default: 0)-M, --max <value>: Maximum scale value (default: 100)-w, --width <value>: Graph width in characters (default: 100)-l, --label <text>: Label for the graph (default: "Label")-c, --color <color>: Graph color (red, green, yellow, blue, magenta, cyan, grey, orange*, purple*)-L, --label_color <color>: Label color (red, green, yellow, blue, magenta, cyan, grey, orange*, purple*)-W, --warning <value>: Warning threshold (default: 50)-A, --alert <value>: Alert threshold (default: 80)-t, --title <text>: Graph title-T, --title_color <color>: Title color (default: blue)-g, --legend <text>: Legend text for values
*orange and purple require truecolor terminal support
Compare Graph Specific Options
-G, --legend2 <text>: Legend text for the second value-C, --color2 <color>: Color for the second value's bar
Cumul Graph Specific Options
-v, --values <value>: Add a value to the cumulative graph (can be used multiple times)-c, --colors <colors>: Comma-separated list of colors for each segment-l, --labels <labels>: Comma-separated list of labels for the legend-g, --nolegend: Hide the legend display
Input File Formats
JSON Format
{
"type": "minmax",
"values": [10, 20, 30, 40, 50]
}
Examples
Display CPU usage with custom colors and thresholds
$ charta simple --label "Utilisation CPU" --warning 70 --alert 90 85
Analyze response times from JSON file
$ charta minmax --file response_times.json --label "Temps de Réponse API"
Monitor system metrics with stdin input
$ {for i in 45 67 23 89 12; do echo $i; done} | charta minmax --file stdin --color blue
Compare two values
$ charta compare -B sum -b 1 -M 2300 -t "Pyramide des âges en France en 2018" --legend "Femmes (par milliers)" --legend2 "Hommes (par milliers)" --color "light-red" --color2 "blue" -b 5 -f Age2.txt
Display cumulative values from stdin
$ echo -e "45.2\n62.8\n38.5" | charta cumul --file stdin --colors red,green,blue --labels CPU,RAM,Disk --title "Server Resources"