# HG changeset patch # User Daniele Nicolodi # Date 1318801123 -7200 # Node ID 597c40c5719f2a1e49e44356d3078241dc69b191 # Parent 2827664bb78584e4593c356f3a6c5cb25e7d0b1e Tweak activity plot. diff -r 2827664bb785 -r 597c40c5719f src/ltpdarepo/static/style.css --- a/src/ltpdarepo/static/style.css Sun Oct 16 23:38:41 2011 +0200 +++ b/src/ltpdarepo/static/style.css Sun Oct 16 23:38:43 2011 +0200 @@ -379,6 +379,8 @@ display: inline-block; width: 2em; visibility: hidden; + font-size: 90%; + padding: 2px 0; } .activity td:hover span.num { diff -r 2827664bb785 -r 597c40c5719f src/ltpdarepo/templates/activity.html --- a/src/ltpdarepo/templates/activity.html Sun Oct 16 23:38:41 2011 +0200 +++ b/src/ltpdarepo/templates/activity.html Sun Oct 16 23:38:43 2011 +0200 @@ -14,7 +14,6 @@
- {% set nmax = 300 %} {% for day, num in activity %} {% set height = num * 300 / nmax %}
diff -r 2827664bb785 -r 597c40c5719f src/ltpdarepo/views/browse.py --- a/src/ltpdarepo/views/browse.py Sun Oct 16 23:38:41 2011 +0200 +++ b/src/ltpdarepo/views/browse.py Sun Oct 16 23:38:43 2011 +0200 @@ -610,8 +610,14 @@ GROUP BY ts.begin, ts.end""" % database) activity = curs.fetchall() + + from math import ceil, floor, log10 + nmax = max(num for day, num in activity) or 1 + base = 10**floor(log10(nmax)) + if base < 10: base = 10.0 + nmax = ceil(nmax / base)*base - return render_template('activity.html', database=db, activity=activity, + return render_template('activity.html', database=db, activity=activity, nmax=nmax, curr=today, prev=prev, next=next, dt=relativedelta(days=1))