liquid_feedback_frontend
annotate env/ui/bargraph.lua @ 18:fc9e748660c8
Added tag beta9 for changeset 76a83a88367a
author | jbe |
---|---|
date | Tue Feb 02 00:31:06 2010 +0100 (2010-02-02) |
parents | 80c215dbf076 |
children | 00d1004545f1 |
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@2 | 8 if bar.value > 0 then |
bsw/jbe@4 | 9 local value = bar.value * args.width / args.max_value |
bsw@2 | 10 ui.container{ |
bsw@2 | 11 attr = { |
bsw@2 | 12 style = "width: " .. tostring(value) .. "px; background-color: " .. bar.color .. ";", |
bsw@2 | 13 title = tostring(bar.value) |
bsw@2 | 14 }, |
bsw@2 | 15 content = function() slot.put(" ") end |
bsw@2 | 16 } |
bsw@2 | 17 end |
bsw/jbe@0 | 18 end |
bsw/jbe@0 | 19 end |
bsw/jbe@0 | 20 } |
bsw/jbe@0 | 21 end |