Code Monkey home page Code Monkey logo

termeter's Introduction

termeter

Visualize data in the terminal

Description

termeter can visualize data in the terminal. Data can be passed by pipe or file.

$  seq 100 | awk 'BEGIN{OFS="\t"; print "x","sin(x)","cos(x)"}{x=$1/10; print x,sin(x),cos(x)}' | termeter

screenshot01

You can even draw charts from streaming data.

$ seq 300 | awk 'BEGIN{OFS="\t"; print "x","sin(x)","cos(x)"}{x=$1/10; print x,sin(x),cos(x); system("sleep 0.1")}' | termeter

Installation

$ go get github.com/atsaki/termeter/cmd/termeter

Input Data

You can input data with stdin or file.

$ cat data.txt | termeter
$ termeter data.txt

termeter can accept tabular data like CSV. Delimiter character can be specified with option '-d DELIMITER'. Default is tab.

Chart types

termeter supports following chart types.

  • LINE
    • Plot values as line plot
  • COUNTER
    • Bar chart of frequencies
  • CDF
    • Cumulative distribution function

By default, termeter choose chart type automatically from second line of data. If value is numeric LINE is choosed. Otherwise, COUNTER is choosed.

You can specify chart type with option -t TYPESTRING. nth character of TYPESTRING corresponds to nth chart type. Following charcters can be used.

  • l: LINE
  • c: COUNTER
  • d: CDF
  • other: auto

Example of chart types

$ (echo "line counter cdf"; seq 1 1000 | awk '{x=int(6*rand())+1; print x,x,x}') | termeter -d " " -t lcd -S numerical

charttype

Use case

It is useful to draw chart of resouce in the terminal. You can use tools like dstat.

$ dstat --cpu --output dstat.log > /dev/null &
$ tail -f -n +7 dstat.log | termeter -d ,

License

MIT

termeter's People

Contributors

atsaki avatar todashuta avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

termeter's Issues

how to plot 3 cdfs from 3 columns

Hi,

I just discovered termeter and I find it a very useful tool.

Question:
I have a tsv file where I want to plot 3 columns as 3 cdfs. How can I do it?

cat myfile.tsv | cut -f 6-9 | termeter <parameters here for 3 cdfs>

Thanks

Pipes are not read after they are exhausted

We need to periodically run some command and add the output to the plot.

session-1 $ mkfifo /tmp/fifo
session-1 $ echo "i\tx\ty" >> /tmp/fifo
session-1 $ echo "1\t0\t3" >> /tmp/fifo
session-1 $ echo "2\t1\t4" >> /tmp/fifo
...

session-2 $ ./termeter < /tmp/fifo
# termeter starts and plots the data

session-1 $ echo "10\t33\t44" >> /tmp/fifo
# this data does not get plotted since fifo is exhausted by the start of termeter

Workaround is sending the output to a temp file and starting termeter with tail -f tempfile; it would be great if we could do it without using tail.

distrubute the binary via homebrew for OSX

This is really a brilliant piece of software, and when you need something like this a google search reveals very few options, gnuplot with set terminal dumb is the main reasonable choice.

This would be accessible to a much wider audience if it could be installed via homebrew, the package manger for macOS / OSX. Basically its a sane way to manage executables.

A perfect example is hugo, the static website generator written in golang, with a simple install via brew install hugo.

I don't program in go, but termeter is perfect for me therefore I went to the trouble of installing go, dealing with path updates to my .zshrc, etc. And then go build termeter.

This is too much work when all I need is the executable.

online updates doesn't work

trying to do
./myprogram|awk 'dumponevaluehere'|termeter
and nothing plotted till myprogramm end. But executing
./myprogram|awk 'dumponevaluehere'
shown value of interest online...

undefined: termui.Point

I can't get termeter by following errors.

$ go get -v github.com/atsaki/termeter/cmd/termeter
github.com/atsaki/termeter
# github.com/atsaki/termeter
go/src/github.com/atsaki/termeter/barchart.go:31: undefined: termui.Point
go/src/github.com/atsaki/termeter/linechart.go:38: undefined: termui.Point
go/src/github.com/atsaki/termeter/list.go:31: undefined: termui.Point
go/src/github.com/atsaki/termeter/par.go:31: undefined: termui.Point
go/src/github.com/atsaki/termeter/widget.go:10: undefined: termui.Point

Can't figure out how to build termeter

Hi;

I've never used go before, but termeter looks good enough that I'm making the effort.

Getting it running was hard; I had assumptions that were not true. Here's how to get termeter running, for beginners:

echo 'export GOPATH=$HOME/gocode' >> ~/.bashrc
echo 'export GOBIN=$HOME/bin' >> ~/.bashrc
source ~/.bashrc
go get github.com/atsaki/termeter/cmd/termeter
cd $GOPATH/src/github.com/atsaki/termeter/cmd/termeter/
go build
./termeter --help
go install
$GOBIN/termeter --help

Here are the things I figured out:

  1. Using 'cd /tmp; git clone https://github.com/atsaki/termeter.git; cd termeter; go build' won't work; the files have to be in the right directory.
  2. The $GOPATH and $GOBIN environment variables have to exist.
  3. The 'go build' command must be run in $GOPATH/src/github.com/atsaki/termeter/cmd/termeter/ , not $GOPATH/src/github.com/atsaki/termeter
  4. If you do 'go build' in that directory, termeter will be created in that directory. If you do 'go install', termeter will be moved to $GOBIN/termeter. However, if you do 'go install -a github.com/atsaki/termeter/cmd/termeter' from your home directory, you'll get 'go install runtime: open /usr/lib/golang/pkg/linux_amd64/runtime.a: permission denied'
  5. If you're in the same directory as the README.md file, 'go build' won't create 'termeter' and won't print any error messages; you have to be do 'cd ./cmd/termeter; go build'.

Ok, thanks for writing this!

Termeter doesn't respond to SIGINT

On Ubuntu 18.04, in Tilix, sending Ctrl + C (SIGINT) does not do anything and the process continues running. I have to use the kill command to kill the process.

What could be the reason for this?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.