asciigraph

Go 软件包,用于在命令行应用程序中制作轻量级 ASCII 线图╭┈╯,无需其他依赖项。「Go package to make lightweight ASCII line graph ╭┈╯ in command line apps with no other dependencies.」

Github星跟蹤圖

.. --restructuredtext--

asciigraph

.. image:: https://travis-ci.org/guptarohit/asciigraph.svg?branch=master
:target: https://travis-ci.org/guptarohit/asciigraph
:alt: Build status

.. image:: https://goreportcard.com/badge/github.com/guptarohit/asciigraph
:target: https://goreportcard.com/report/github.com/guptarohit/asciigraph
:alt: Go Report Card

.. image:: https://coveralls.io/repos/github/guptarohit/asciigraph/badge.svg?branch=master
:target: https://coveralls.io/github/guptarohit/asciigraph?branch=master
:alt: Coverage Status

.. image:: https://godoc.org/github.com/guptarohit/asciigraph?status.svg
:target: https://godoc.org/github.com/guptarohit/asciigraph
:alt: GoDoc

.. image:: https://img.shields.io/badge/licence-BSD-blue.svg
:target: https://github.com/guptarohit/asciigraph/blob/master/LICENSE
:alt: License

.. image:: https://awesome.re/mentioned-badge-flat.svg
:target: https://github.com/avelino/awesome-go#advanced-console-uis
:alt: Mentioned in Awesome Go, Go package to make lightweight ASCII line graphs ╭┈╯.

.. image:: https://user-images.githubusercontent.com/7895001/41509956-b1b2b3d0-7279-11e8-9d19-d7dea17d5e44.png

Installation

::

go get github.com/guptarohit/asciigraph

Usage

Basic graph
^^^^^^^^^^^

.. code:: go

package main

import (
    "fmt"
    "github.com/guptarohit/asciigraph"
)

func main() {
    data := []float64{3, 4, 9, 6, 2, 4, 5, 8, 5, 10, 2, 7, 2, 5, 6}
    graph := asciigraph.Plot(data)

    fmt.Println(graph)
}

Running this example would render the following graph:

::

10.00 ┤ ╭╮
9.00 ┤ ╭╮ ││
8.00 ┤ ││ ╭╮││
7.00 ┤ ││ ││││╭╮
6.00 ┤ │╰╮ ││││││ ╭
5.00 ┤ │ │ ╭╯╰╯│││╭╯
4.00 ┤╭╯ │╭╯ ││││
3.00 ┼╯ ││ ││││
2.00 ┤ ╰╯ ╰╯╰╯

..

Command line interface

This package also brings a small utility for command line usage. Assuming
$GOPATH/bin is in your $PATH, simply go get it then install CLI.

CLI Installation
^^^^^^^^^^^^^^^^

::

go install github.com/guptarohit/asciigraph/cmd/asciigraph

Feed it data points via stdin:

::

$ seq 1 72, asciigraph -h 10 -c "plot data from stdin"
72.00 ┼
65.55 ┤ ╭────
59.09 ┤ ╭──────╯
52.64 ┤ ╭──────╯
46.18 ┤ ╭──────╯
39.73 ┤ ╭──────╯
33.27 ┤ ╭───────╯
26.82 ┤ ╭──────╯
20.36 ┤ ╭──────╯
13.91 ┤ ╭──────╯
7.45 ┤ ╭──────╯
1.00 ┼──╯
plot data from stdin

..

Acknowledgement

This package is golang port of library asciichart <https://github.com/kroitor/asciichart>_ written by @kroitor <https://github.com/kroitor>_.

Contributing

Feel free to make a pull request! :octocat:

主要指標

概覽
名稱與所有者guptarohit/asciigraph
主編程語言Go
編程語言Go (語言數: 2)
平台
許可證BSD 3-Clause "New" or "Revised" License
所有者活动
創建於2018-06-17 10:37:16
推送於2024-10-26 07:43:10
最后一次提交2024-10-26 13:08:47
發布數20
最新版本名稱v0.7.3 (發布於 2024-10-26 13:12:54)
第一版名稱v0.1.1 (發布於 2018-06-23 19:51:32)
用户参与
星數2.8k
關注者數28
派生數103
提交數124
已啟用問題?
問題數26
打開的問題數9
拉請求數28
打開的拉請求數2
關閉的拉請求數6
项目设置
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?