Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

ASCII terminal line charts with no dependencies

License

NotificationsYou must be signed in to change notification settings

sndnv/asciichart

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Hex version badgecodecovlicense

Terminal ASCII line charts in Elixir with no dependencies.

Terminal ASCII line charts in Elixir

Ported to Elixir fromkroitor/asciichart

Install

Addasciichart to the list of dependencies inmix.exs:

defdepsdo[{:asciichart,"~> <version>"}]end

Usage

{:ok,chart}=Asciichart.plot([1,2,3,3,2,1])chart|>IO.puts()# should render as3.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
  • charset - a customizable character set. SeeAsciichart.Charset.
  • precision - number of fractional digits to keep for floating-point values
{:ok,chart}=Asciichart.plot([1,2,5,5,4,3,2,100,0],height:3,offset:10,padding:"__")chart|>IO.puts()# should render as       ╭─>label------100.00    ┼      ╭╮_50.00    ┤      ││__0.00    ┼──────╯╰------ ╰─>labelpadding ╰─>remainingoffset(withoutthelabel)# Rendering of empty charts is not supportedAsciichart.plot([]){:error,"No data"}

If you want to change the character set, you can use a predefined one inAsciichart.Charset or create your own.

{:ok,chart}=Asciichart.plot([1,2,5,5,4,3,2,0],height:5,charset:Asciichart.Charset.single_char("*"))chart|>IO.puts()5.00***3.75 ┤ * **2.50***1.25 ┤**   **0.00 ***

Versioning

We useSemVer for versioning.

License

This project is licensed under the Apache License, Version 2.0 - see theLICENSE file for details

Copyright 2018https://github.com/sndnv

Licensed under the Apache License, Version 2.0 (the "License");you may not use this file except in compliance with the License.You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, softwaredistributed under the License is distributed on an "AS IS" BASIS,WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.See the License for the specific language governing permissions andlimitations under the License.


[8]ページ先頭

©2009-2025 Movatter.jp