datadash

package module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 2, 2023 License: MIT Imports: 12 Imported by: 0

README

DataDash

A data visualization tool for the terminal.

Input streaming or tabular data inside the terminal via pipe or file, and an interactive graph will be generated.

Chart types

datadash currently supports following chart types:

  • Line
  • Plot tabular or streaming data as line graph
  • Line graph supports zooming with the scroll wheel or trackpad
  • Supports X-Axis Auto scaling
  • Displays the average value with the -a option (customize how many values to consider using -z)
  • Different color lines for each graph
  • Supports scrolling for streaming data applications (disable with the --no-scroll option)
  • Displays up to five graphs simultaneously
  • Displays Min, Mean, Max, and Outliers
  • Customize the screen redraw interval and input seek interval for high latency or low bandwidth environments
  • No dependencies, only one file is required
  • Sample datasets included
  • Bar
  • Support for Bar Graphs (Beta)
  • SparkLine
  • Support for SparkLine Graphs (Beta)
Streaming Data: (Linechart)
1col-scrolling.gif
Streaming Data: (Barchart)
4col-scrolling.gif
Streaming Data: (SparkLines)
4col-sparkline.gif
Demo (Streaming data):

This will continue scrolling to the right, displaying the most recent data first and removing the older data to the left.

seq 4000 | awk 'BEGIN{OFS="\t"; print "x"}{x=$1/10; print cos(x) system("sleep 0.01")}' | ./datadash --label-mode time --scroll
Tabular Data:
4col-scrolling.gif
Demo: (2 columns of data):
seq 4000 | awk 'BEGIN{OFS="\t"; print "x","sin(x)"}{x=$1/10; print x,sin(x); system("sleep 0.02")}'  | ./datadash --label-mode time
Line graph Demo: (6 columns of data) w/ grey average line:
seq 4000 | awk 'BEGIN{OFS="\t"; print "x","sin(x)","cos(x)", "rand(x)", "rand(x)", "rand(x)"}{x=$1/10; print x,sin(x),cos(x),rand(x),rand(x),rand(x); system("sleep 0.02")}'  | ./datadash -a
Installation
go get -u github.com/keithknott26/datadash
go build cmd/datadash ; cd cmd
./datadash --help

datadash can accept tabular data like CSV, TSV, or you can use a custom delimiter with the -d option. The default delimiter is tab.

Input Methods

Input data from stdin or file.

$ cat data.txt | datadash
$ datadash data.txt

Data Structure

Below are examples of the accepted data structure. More examples can be found under /tools/sampledata

Streaming Data (1 graph):
50
60
70
3 Columns (2 graphs): (\t is the tab charachter)
time\tRowLabel1\tRowLabel2
00:00\t50\t100
00:01\t60\t90
00:02\t70\t80
00:08\t80\t70
23:50\t10\t10

Arguments

$ usage: datadash [<flags>] [<input file>]

Flags:
--help  Show context-sensitive help (also try --help-long and --help-man).
--debug Enable Debug Mode
-d, --delimiter="\t"  Record Delimiter:
-m, --label-mode="first"  X-Axis Labels: 'first' (use the first record in the column) or 'time' (use the current time)
-s, --scroll  Whether or not to scroll chart data
-a, --average-line  Enables the line representing the average of values
-z, --average-seek=500  The number of values to consider when displaying the average line: (50,100,500...)
-r, --redraw-interval=10ms  The interval at which objects on the screen are redrawn: (100ms,250ms,1s,5s..)
-l, --seek-interval=20ms  The interval at which records (lines) are read from the datasource: (100ms,250ms,1s,5s..)

Args:

[<input file>]  A file containing a label header, and data in columns separated by a delimiter 'd'. Data piped from Stdin uses the same format

A graphing application written in go using termdash, inspired by termeter.
License

MIT

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Float64s

func Float64s(a []float64) int

Float64s calls unique on a slice of float64.

func Float64sAreUnique

func Float64sAreUnique(a []float64) bool

Float64sAreUnique tests whether the slice of float64 is sorted and unique.

func Ints

func Ints(a []int) int

Ints calls unique on a slice of int.

func IntsAreUnique

func IntsAreUnique(a []int) bool

IntsAreUnique tests whether the slice of int is sorted and unique.

func IsUnique

func IsUnique(data Interface) bool

IsUnique reports whether data is sorted and unique.

func Stable

func Stable(data Interface) int

Stable moves the first unique elements to the beginning of the *sorted* collection and returns the number of unique elements, but also keeps the original order of duplicate elements.

It makes one call to data.Len, O(n) calls to data.Less, and O(n*log(n)) calls to data.Swap.

func Strings

func Strings(a []string) int

Strings calls unique on a slice of string.

func StringsAreUnique

func StringsAreUnique(a []string) bool

StringsAreUnique tests whether the slice of string is sorted and unique.

func Uniq

func Uniq(data Interface) int

Uniq moves the first unique elements to the beginning of the *sorted* collection and returns the number of unique elements.

It makes one call to data.Len to determine n, n-1 calls to data.Less, and O(n) calls to data.Swap. The unique elements remain in original sorted order, but the duplicate elements do not.

Types

type Interface

type Interface interface {
	// Len returns the number of elements.
	Len() int
	// Less tells if the element at index i should come
	// before the element at index j.
	Less(i, j int) bool
	// Swap swaps the elements at indexes i and j.
	Swap(i, j int)
}

Interface to use the uniq package. Identical to sort.Interface.

type Panel

type Panel interface {
	NewRow() *Row
	InitWidgets() *Row
	NewContainer() []container.Option
	Update()
}

type Row

type Row struct {
	ID               int
	Label            string
	Scroll           bool
	Average          bool
	Labels           *stringRingBuffer
	Context          context.Context
	Data             *float64RingBuffer
	Averages         *float64RingBuffer
	LineChart        *linechart.LineChart
	BarChart         *barchart.BarChart
	SparkLine        *sparkline.SparkLine
	Textbox          *text.Text
	DataContainer    []float64
	LabelContainer   []string
	AverageContainer []float64
	RedrawInterval   time.Duration
	SeekInterval     time.Duration
}

func NewRow

func NewRow(ctx context.Context, label string, bufsize int, id int, scroll bool, average bool) *Row

func (*Row) ContainerOptions

func (r *Row) ContainerOptions(ctx context.Context, graphType string) []container.Option

func (*Row) InitWidgets

func (r *Row) InitWidgets(ctx context.Context, graphType string, label string, reDrawInterval time.Duration, seekInterval time.Duration) *Row

func (*Row) Update

func (r *Row) Update(x float64, dataLabel string, averageSeek int)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL