forked from yaronn/blessed-contrib
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathline-random-colors.js
More file actions
37 lines (31 loc) · 797 Bytes
/
line-random-colors.js
File metadata and controls
37 lines (31 loc) · 797 Bytes
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
var blessed = require('blessed')
, contrib = require('../index')
function randomColor() {
return [Math.random() * 255,Math.random()*255, Math.random()*255]
}
var screen = blessed.screen()
, line = contrib.line(
{ width: 80
, height: 30
, left: 15
, top: 12
, xPadding: 5
, minY: 30
, maxY: 90
, label: 'Title'
, style: { line: randomColor(), text: randomColor(), baseline: randomColor() }
})
, data = [ { title: 'us-east',
x: ['t1', 't2', 't3', 't4'],
y: [50, 88, 72, 91],
style: {
line: 'red'
}
}
]
screen.append(line) //must append before setting data
line.setData(data)
screen.key(['escape', 'q', 'C-c'], function(ch, key) {
return process.exit(0);
});
screen.render()