8000 GitHub - 4tyTwo/asciichart: Erlang asciichart port
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Erlang asciichart port

License

Notifications You must be signed in to change notification settings

4tyTwo/asciichart

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

asciichart

Terminal ASCII line charts in Erlang.

Terminal ASCII line charts in Elixir

Ported to Erlang from kroitor/asciichart based on Elixir port, made by sndnv.

Install

Add asciichart to the list of dependencies in rebar.config:

{deps, [
    {asciichart,
        {git, "https://github.com/4tyTwo/asciichart.git",
            {branch, master}
        }
    }
]}.

Usage

{ok, Chart} = asciichart:plot([1, 2, 3, 3, 2, 1]),
asciichart:print(Chart).

% should render as

3.00 ┤ ╭─╮
2.00 ┤╭╯ ╰╮
1.00 ┼╯   ╰

Options

One or more of the following settings can be provided:

  • offset - number of characters to set as the chart's (left) offset
  • height - adjusts the height of the chart
  • padding - one or more characters to use for the label's (left) padding
{ok, Chart} = asciichart:plot([1, 2, 5, 5, 4, 3, 2, 100, 0], #{height => 3, offset => 10, padding: <<"_">>}).
asciichart:print(Chart).

% should render as

       ╭─> label
    ------
    100.00    ┼      ╭╮
    _50.00    ┤      ││
    __0.00    ┼──────╯╰
    --
---- ╰─> label padding
 ╰─> remaining offset (without the label)

% Rendering of empty charts is not supported

asciichart:plot([])
{error, no_data}

About

Erlang asciichart port

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

0