various graph fixes

- remove bars, as they are the main cause of slowdowns
- limit cumulative and due only in the future (fixes late decks)
- don't use outlines for periods over 1 year
This commit is contained in:
Damien Elmes 2008-12-13 18:04:43 +09:00
parent daeba6f78b
commit af28484154

View file

@ -86,7 +86,9 @@ select day, reps
from stats""")
todaydt = datetime.datetime(*list(time.localtime(time.time())[:3]))
self.stats["dayReps"] = dict(map(lambda dr: (-(todaydt - datetime.datetime(*(int(x) for x in dr["day"].split("-")))).days, dr["reps"]), dayReps))
self.stats["dayReps"] = dict(
map(lambda dr: (-(todaydt -datetime.datetime(
*(int(x)for x in dr["day"].split("-")))).days, dr["reps"]), dayReps))
def nextDue(self, days=30):
@ -101,7 +103,8 @@ from stats""")
argl = []
for dayslist in dayslists[:days]:
argl.extend(list(self.unzip(dayslist.items(), limit=days)))
dl = [x for x in dayslist.items() if x[0] <= days]
argl.extend(list(self.unzip(dl)))
self.filledGraph(graph, days, ["#7777ff", "#77ffff"], *argl)
@ -130,7 +133,8 @@ from stats""")
self.calcStats()
fig = Figure(figsize=(self.width, self.height), dpi=self.dpi)
graph = fig.add_subplot(111)
(x, y) = self.unzip(self.stats['next'].items(), limit=days)
dl = [x for x in self.stats['next'].items() if x[0] <= days]
(x, y) = self.unzip(dl)
count=0
y = list(y)
for i in range(len(x)):
@ -142,7 +146,7 @@ from stats""")
break
x = list(x); x.append(99999)
y.append(count)
self.filledGraph(graph, days, "#aaaaff", x, y)
self.filledGraph(graph, days, "#ffccff", x, y)
graph.set_xlim(xmin=self.stats['lowestInDay'], xmax=days)
graph.set_ylim(ymax=graph.get_ylim()[1]+10)
return fig
@ -216,9 +220,14 @@ from stats""")
x.append(highest + 1)
y.append(0)
# plot
graph.fill(x, y, c, lw = int(days < 180 and thick) * 2 + int(days >= 180 and thick))
lw = 0
if days < 180:
graph.bar(x, y, width=0)
lw += 1
if thick:
lw += 1
if days > 360:
lw = 0
graph.fill(x, y, c, lw = lw)
thick = False
graph.grid(True)