mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 16:56:36 -04:00
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:
parent
daeba6f78b
commit
af28484154
1 changed files with 17 additions and 8 deletions
|
@ -80,13 +80,15 @@ from cards where type = 1 and priority in (1,2,3,4) and interval > 21""")
|
||||||
'mature': daysMature}
|
'mature': daysMature}
|
||||||
self.stats['months'] = months
|
self.stats['months'] = months
|
||||||
self.stats['lowestInDay'] = lowestInDay
|
self.stats['lowestInDay'] = lowestInDay
|
||||||
|
|
||||||
dayReps = self.deck.s.all("""
|
dayReps = self.deck.s.all("""
|
||||||
select day, reps
|
select day, reps
|
||||||
from stats""")
|
from stats""")
|
||||||
|
|
||||||
todaydt = datetime.datetime(*list(time.localtime(time.time())[:3]))
|
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):
|
def nextDue(self, days=30):
|
||||||
|
@ -101,7 +103,8 @@ from stats""")
|
||||||
argl = []
|
argl = []
|
||||||
|
|
||||||
for dayslist in dayslists[:days]:
|
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)
|
self.filledGraph(graph, days, ["#7777ff", "#77ffff"], *argl)
|
||||||
|
|
||||||
|
@ -130,7 +133,8 @@ from stats""")
|
||||||
self.calcStats()
|
self.calcStats()
|
||||||
fig = Figure(figsize=(self.width, self.height), dpi=self.dpi)
|
fig = Figure(figsize=(self.width, self.height), dpi=self.dpi)
|
||||||
graph = fig.add_subplot(111)
|
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
|
count=0
|
||||||
y = list(y)
|
y = list(y)
|
||||||
for i in range(len(x)):
|
for i in range(len(x)):
|
||||||
|
@ -142,7 +146,7 @@ from stats""")
|
||||||
break
|
break
|
||||||
x = list(x); x.append(99999)
|
x = list(x); x.append(99999)
|
||||||
y.append(count)
|
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_xlim(xmin=self.stats['lowestInDay'], xmax=days)
|
||||||
graph.set_ylim(ymax=graph.get_ylim()[1]+10)
|
graph.set_ylim(ymax=graph.get_ylim()[1]+10)
|
||||||
return fig
|
return fig
|
||||||
|
@ -191,7 +195,7 @@ from stats""")
|
||||||
tuples = tuples[-limit - 1:]
|
tuples = tuples[-limit - 1:]
|
||||||
else:
|
else:
|
||||||
tuples = tuples[:limit + 1]
|
tuples = tuples[:limit + 1]
|
||||||
|
|
||||||
new = zip(*tuples)
|
new = zip(*tuples)
|
||||||
return new
|
return new
|
||||||
|
|
||||||
|
@ -216,9 +220,14 @@ from stats""")
|
||||||
x.append(highest + 1)
|
x.append(highest + 1)
|
||||||
y.append(0)
|
y.append(0)
|
||||||
# plot
|
# plot
|
||||||
graph.fill(x, y, c, lw = int(days < 180 and thick) * 2 + int(days >= 180 and thick))
|
lw = 0
|
||||||
if days < 180:
|
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
|
thick = False
|
||||||
|
|
||||||
graph.grid(True)
|
graph.grid(True)
|
||||||
|
|
Loading…
Reference in a new issue