liquid_feedback_frontend
annotate env/ui/bargraph.lua @ 4:80c215dbf076
Version alpha5
Many optical changes and improved usability
Support for different wiki-formatting-engines
Help system
Many optical changes and improved usability
Support for different wiki-formatting-engines
Help system
author | bsw/jbe |
---|---|
date | Thu Dec 10 12:00:00 2009 +0100 (2009-12-10) |
parents | 5c601807d397 |
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 |