use tui;
use tui::sparkline;
use tui::block;
use tui::text;
let data = {
let clock = time::timer(duration:0.3s, true);
let v = rand::rand(#clock, #start:0., #end:100.);
let d = [];
let color = select v {
v if v <= 25. => `Green,
v if v <= 50. => `Yellow,
_ => `Red
};
let v = sparkline_bar(#style: style(#fg: color), v);
d <- array::window(#n:80, clock ~ d, v);
d
};
block(
#border: &`All,
#title: &line("Network Traffic Rate"),
&sparkline(
#style: &style(#fg: `Green),
#max: &100,
&data
)
)