crystal_cli_graph
Version, currently 0.1.13 versions
- 1.0.0latestMay 13, 2019
- 0.1.1not indexedMay 13, 2019
- 0.1.0not indexedMay 13, 2019
github.com/masukomi/crystal_cli_graph
An simple generator of text bar graphs.
Nothing has been indexed for 0.1.1 yet. The tag is recorded, its shard.yml has not been read, so the manifest and dependency list below are empty because they are unknown rather than because they are absent.
Installation
# Add this to your shard.yml
dependencies:
crystal_cli_graph:
github: masukomi/crystal_cli_graph
version: ~> 0.1.1Then run:
shards installshard.yml
No shard.yml has been indexed for 0.1.1. You can read it on the repository.
Dependencies
Unknown: the shard.yml for this version has not been read yet.
README
This README is the one indexed from the repository at its latest ref, not from the tag for this version.
crystal_cli_graph
A simple command line graphing library for Crystal. It can make graphs:
- to specified heights and widths
- with optional Y Axis Labels
- with optional key's and legends for the items in the graph.
|
|
|
Y|
|
A|
x| ▁
i| ▁ █
s| ▁ █ █
| ▁ █ █ █
L| ▁ █ █ █ █
a| ▁ █ █ █ █ █
b| ▁ █ █ █ █ █ █
e| ▁ █ █ █ █ █ █ █
l|▁ ▁ █ █ █ █ █ █ █ █
a b c d e f g h i j
+-------------------------------------+
| a: label-1 x |
| b: label-2 xxxxxxxx |
| c: label-3 xxxxxx |
| d: label-4 |
| e: label-5 xxxxxxxx |
| f: label-6 xx |
| g: label-7 xxxxxxxxx |
| h: label-8 xxxxxxxxx |
| i: label-9 x |
| j: label-10 xx |
+-------------------------------------+
Installation
Add this to your application's shard.yml:
dependencies:
crystal_cli_graph:
github: masukomi/crystal_cli_graph
Usage
require "crystal_cli_graph"
options = Hash(Symbol, Bool | Int32 | String? | Array(String)).new
# fit_min => optional Bool
# max_height => optional Int32
# The max_height will be exceeded if the length of the y_axis_label
# is bigger than the number specified.
# max_width => optional Int32
# It will attempt to create a graph of this width (if specified).
# The max_width will be exceeded if there is more data provided
# than the max_width allows.
# Addition of enough elements + labels can also cause it to exceed max_width
# because of the need for unique keys.
# y_axis_label => optional String
# column_labels => optional Array(String)
# If you provide labels for the columns there will be a legend.
# If you don't, there won't.
# no_legend => Optional Bool
# If you say no_legend and don't provide labels it'll just generate a graph
# If you say no_legend and _do_ provide labels it'll use those under
# each graph line instead of generating them itself.
# column_body => Optional String
# Columns are made of the column_body character and topped with the
# bar_topper character. See example.cr for how this can be used.
# bar_topper => Optional String
# the bar_topper is displayed at the top of each bar, even if there
# is a zero value. Without it empty bars can be hard to see. See
# example.cr for how this can be used.
data = [1, 2, 3]
labels = ["foo", "bar", "baz"]
options[:column_labels] = labels
options[:y_axis_label] = "Y Axis Label"
g = CrystalCliGraph::Graph.new(data, options)
puts g.generate
Development
Features will be added as needed, or as PR contributions are made. The goal is to eventually have support for bar graphs that look like bars not just lines, maybe line graphs. Who knows.
Contributing
- Fork it ( https://github.com/masukomi/crystal_cli_graph/fork )
- Create your feature branch (git checkout -b my-new-feature)
- Commit your changes (git commit -am 'Add some feature')
- Push to the branch (git push origin my-new-feature)
- Create a new Pull Request
Contributors
- masukomi masukomi - creator, maintainer
Documentation
Built from the current release. The first visit to a release nobody has asked for starts its build.
Links
This release
- Version
0.1.1- Tagged
- May 13, 2019
- Commit
b687029a6899- Indexed
- not yet
Dependents
No indexed shard depends on this one yet.
Repository
github.com/masukomi/crystal_cli_graph
Metadata
- Created
- Aug 12, 2026
- Updated
- Aug 15, 2026
- Synced
- Aug 14, 2026
- Versions
- 3