generate a separate cumulative plot for each revlog type

This commit is contained in:
Damien Elmes 2011-04-17 12:33:27 +09:00
parent b422019970
commit 003737c03f

View file

@ -259,27 +259,33 @@ group by day order by day""" % (self._limit(), lim),
def _splitRepData(self, data, spec): def _splitRepData(self, data, spec):
sep = {} sep = {}
tot = 0 totcnt = {}
totd = [] totd = {}
alltot = []
allcnt = 0
for (n, col, lab) in spec:
totcnt[n] = 0
totd[n] = []
sum = [] sum = []
for row in data: for row in data:
rowtot = 0
for (n, col, lab) in spec: for (n, col, lab) in spec:
if n not in sep: if n not in sep:
sep[n] = [] sep[n] = []
sep[n].append((row[0], row[n])) sep[n].append((row[0], row[n]))
tot += row[n] totcnt[n] += row[n]
rowtot += row[n] allcnt += row[n]
totd.append((row[0], tot)) totd[n].append((row[0], totcnt[n]))
sum.append((row[0], rowtot)) alltot.append((row[0], allcnt))
ret = [] ret = []
for (n, col, lab) in spec: for (n, col, lab) in spec:
ret.append(dict(data=sep[n], color=col, label=lab)) if len(totd[n]) > 1 and totcnt[n]:
if len(totd) > 1: # bars
ret.append(dict( ret.append(dict(data=sep[n], color=col, label=lab))
data=totd, color=colCum, label=_("Cumulative"), yaxis=2, # lines
bars={'show': False}, lines=dict(show=True), stack=False)) ret.append(dict(
return (ret, totd) data=totd[n], color=col, label=None, yaxis=2,
bars={'show': False}, lines=dict(show=True), stack=-n))
return (ret, alltot)
def _done(self, num=7, chunk=1): def _done(self, num=7, chunk=1):
lims = [] lims = []
@ -486,7 +492,7 @@ order by thetype, ease""" % lim)
xaxis=dict(ticks=[[0, _("4AM")], [6, _("10AM")], xaxis=dict(ticks=[[0, _("4AM")], [6, _("10AM")],
[12, _("4PM")], [18, _("10PM")], [23, _("3AM")]]), [12, _("4PM")], [18, _("10PM")], [23, _("3AM")]]),
yaxis=dict(max=peak)), yaxis=dict(max=peak)),
ylabel=_("% Correct")) ylabel=_("%Correct"))
return txt return txt
def _hourRet(self): def _hourRet(self):