liquid_feedback_frontend
diff env/ui/bargraph.lua @ 0:3bfb2fcf7ab9
Version alpha1
author | bsw/jbe |
---|---|
date | Wed Nov 18 12:00:00 2009 +0100 (2009-11-18) |
parents | |
children | 5c601807d397 |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/env/ui/bargraph.lua Wed Nov 18 12:00:00 2009 +0100 1.3 @@ -0,0 +1,19 @@ 1.4 +function ui.bargraph(args) 1.5 + ui.container{ 1.6 + attr = { 1.7 + class = "bargraph", 1.8 + }, 1.9 + content = function() 1.10 + for i, bar in ipairs(args.bars) do 1.11 + local value = bar.value * args.width / args.max_value / 2 1.12 + ui.container{ 1.13 + attr = { 1.14 + style = "width: " .. tostring(value) .. "px; background-color: " .. bar.color .. ";", 1.15 + title = tostring(bar.value) 1.16 + }, 1.17 + content = function() slot.put(" ") end 1.18 + } 1.19 + end 1.20 + end 1.21 + } 1.22 +end