-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathREADME
124 lines (105 loc) · 7.46 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
==== SYNOPSIS ==================================================================
A neat little charting program that runs in the terminal.
It reads numeric values from <filename> (or in the absence of the <filename>
argument, or if <filename> is '-', stdin) and plots them on a chart that is
drawn directly in the terminal.
==== USAGE =====================================================================
Invoke chart with the syntax:
chart [<option>...] [<filename>]
The input is to be formatted in lines of text as follows:
[,]<number>[,<number>...]
Each line beginning with a number not prefixed by a comma is taken to represent
a new data point. Each number prefixed by a comma (i.e., the first numbers in
lines which begin with commas and those numbers following other numbers on the
same line and delimited by commas) is taken to represent an update to the most
recent data point.
==== DEPENDENCIES ==============================================================
chart depends on curses.
==== INSTALLATION ==============================================================
To build chart, type:
make
To install chart:
make [DESTDIR=<path>] [PREFIX=<path>] install
If not specified, DESTDIR is "" and PREFIX is "/usr/local" by default.
==== LICENSE ===================================================================
See LICENSE.
==== EXAMPLES ==================================================================
Try the following BASH scripts:
#!/bin/bash
y=0
while true; do
for i in $(seq 1 4); do
y=$((y + RANDOM % 9 - 4))
if (( $y > 127 )); then
y=127
elif (( $y < -128 )); then
y=-128
fi
if (( $i != 1 )); then
echo -n ,
fi
echo $y
done
sleep 0.2
done | ./chart -s ohlc -t '$RANDOM' "$@"
┌─── $RANDOM ───────────────────────────────────────────────────────────────┐
│ ┌┌┴┬ ┤16
│ │ ┌┤┤ │┐┐ │
│ ┴├┘ ├│┌┌┐┬┤-1
│ ┌ ┘ └┘┤└││
│ ┐┘ │
│ ┌┼┬└ │
│ │ ││ │
│ ┌┴┬┘ │
│ ┘ │
│ ├┌ │
│ │ │┘┘ │
│ ┴┐ │┴ │
│ ┌ │┐ ┴ │
│ │ ├┤ └│┌ │
│┐├┬┐ ┐ ┌┘ └┘ │
│├┘│└┬ │ ┌ │┐┐ │┤┼└││ │
│ ┬ ┐ ┌┴┐ ┌┘┐ ┤│┐ │┬┴├│┐┴└ ┼┘ │
│ ┴└┴┤ └┬┬ │ ┘ ├┬└┴├┬┼┴┼│ └└ │
│ │┬├┬┐ ┌ │ │
│ │┘│├┤┌┌┘ │
│ └│┘ │
│ ┘ ┤-88
└───────────────────────────────────────────────────────────────────────────┘
#!/bin/bash
t0=0
five0=0
while read one five1 fifteen _ </proc/loadavg; do
t1=$(($(date +%s) / 450))
if (( $t1 > $t0 )); then
printf ",%s\n%s,%s\n" $five0 $fifteen $five1
t0=$t1
fi
five0=$five1
echo ,$one
sleep 30
done | exec chart -s ohlc -t loadavg
┌─── loadavg ──────────────────────────────────────────────────────────────┐
│ │ ┤1.44
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │
│ ││ │ │ │ │ │
│ ││ │ │ │ ││ │
│ │││ │ │ │ │ │ ││ │ │
│ │ │││ │ │ │ │ │ ││ │ │ │
│ │ │││ │ │ ││ ││ │ │ │ │ ││ │ │ │ │ │
│ │ │││ │ ││ ││ │││ │││ │││ ││ │││ │ ││ ┌┤0.42
│ ││├├│ │ │││ ││ │││││││││││ │├├││ ││││││ ││ ││
│ ││││┤│ │├│├│││ │││││││├│││├├│ │ │││││││││││├│││││ │││
│ │││┤├┤ ││││┼││ │├│├││││┼│││┤┤│ ││ │││┼│││├││├│┤││├├ │││
│ │├││││┐││┼┘│┼┤ │ │├│├│┤├┼┤│┼┼┤│├┤ │├│││┤│┤┼┼┤┼┼┤┤├┼┼┤┤┤│││
│ │ │ │ ├│┘ │├│┤┘│ ││├┤┼┤│││┤┤┤├┤│ │││ ││├┐┤┤┼┼┤││├│││││ │││││││┼┤│
│ ├│├├┼ │ │┤ ││├├ │ │├│├┼┼┘││││ │ │ │ │││├├││││ ││││ │ │││ │├│││
│─┘┴┘┘│───┴──────┘│ ││ ││ │││ │ │ │ │ ┤0
└──────────────────────────────────────────────────────────────────────────┘