Commit e672234c authored by Ryan Herbert's avatar Ryan Herbert
Browse files add bar chart

parent 2f619d0e
......@@ -27,3 +27,15 @@ class BarDecorator(StatDecorator):
def decorate(self, data):
return DIV(SPAN(_style="width: %d%%" % data), _class="meter", _title="%d%%" % data)
class BarChartDecorator(StatDecorator):
def __init__(self):
super(BarChartDecorator, self).__init__()
def decorate(self, data):
bars = []
for val in data:
bar_span = SPAN(_style="height: %d%%; width: %d%%" % (val, (1.0/len(data))*100), _title="%d%%" % val, _class="bar")
return DIV(*bars, _class="bar_chart")
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment