diff options
author | Adrian C. (anrxc) <anrxc@sysphere.org> | 2011-08-07 22:17:26 +0200 |
---|---|---|
committer | Adrian C. (anrxc) <anrxc@sysphere.org> | 2011-08-07 22:17:26 +0200 |
commit | b11d251ef0326a67dee5e53efa8cd3543cea01e1 (patch) | |
tree | 120aa044f3b97e11bcc36da7d3fdb2182e5fc45a /README | |
parent | 44aea3786fff36342907dfd84d3f7b1285cbb879 (diff) | |
download | vicious-legacy-b11d251ef0326a67dee5e53efa8cd3543cea01e1.tar.xz |
README: provide multigraph usage example
Diffstat (limited to 'README')
-rw-r--r-- | README | 23 |
1 files changed, 23 insertions, 0 deletions
@@ -480,6 +480,29 @@ Example - forces a fixed width of 50px to the uptime widget, and aligns its text to the right +Another use case are stacked graphs (aka multigraphs) which Vicious +does not handle on its own at the moment, as it's hard to pass on +color index arguments elegantly. But they are not unusable, far from +it. + +Example + ctext = widget({ type = "textbox"}) + cgraph = awful.widget.graph() + cgraph:set_width(100):set_height(20) + cgraph:set_stack(true):set_max_value(100) + cgraph:set_background_color("#494B4F") + cgraph:set_stack_colors({ "#FF5656", "#88A175", "#AECF96" }) + vicious.register(ctext, vicious.widgets.cpu, + function (widget, args) + cgraph:add_value(args[2], 1) -- Core 1, color 1 + cgraph:add_value(args[3], 2) -- Core 2, color 2 + cgraph:add_value(args[4], 3) -- Core 3, color 3 + end, 3) + + - enables graph stacking/multigraph and plots usage of all three CPU + cores on a single graph, the textbox "ctext" is just an empty + placeholder, graph is updated every 3 seconds + Other ----- |