liquid_feedback_frontend
annotate 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 |
rev | line source |
---|---|
bsw/jbe@0 | 1 function ui.bargraph(args) |
bsw/jbe@0 | 2 ui.container{ |
bsw/jbe@0 | 3 attr = { |
bsw/jbe@0 | 4 class = "bargraph", |
bsw/jbe@0 | 5 }, |
bsw/jbe@0 | 6 content = function() |
bsw/jbe@0 | 7 for i, bar in ipairs(args.bars) do |
bsw/jbe@0 | 8 local value = bar.value * args.width / args.max_value / 2 |
bsw/jbe@0 | 9 ui.container{ |
bsw/jbe@0 | 10 attr = { |
bsw/jbe@0 | 11 style = "width: " .. tostring(value) .. "px; background-color: " .. bar.color .. ";", |
bsw/jbe@0 | 12 title = tostring(bar.value) |
bsw/jbe@0 | 13 }, |
bsw/jbe@0 | 14 content = function() slot.put(" ") end |
bsw/jbe@0 | 15 } |
bsw/jbe@0 | 16 end |
bsw/jbe@0 | 17 end |
bsw/jbe@0 | 18 } |
bsw/jbe@0 | 19 end |