From 60fdadd9e8f1819fa5047bbcb22db0a1f3c3d241 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Fri, 5 Dec 2008 15:15:16 +0900 Subject: [PATCH] fix ease graphs for new button layout --- anki/graphs.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/anki/graphs.py b/anki/graphs.py index ac11c9e18..1f86548fa 100644 --- a/anki/graphs.py +++ b/anki/graphs.py @@ -213,7 +213,7 @@ from cards where type = 1 and priority in (1,2,3,4) and interval > 21""") types = ("new", "young", "mature") enum = 5 offset = 0 - arrsize = 17 + arrsize = 16 arr = [0] * arrsize n = 0 colours = ["#ff7777", "#77ffff", "#7777ff"] @@ -225,7 +225,10 @@ from cards where type = 1 and priority in (1,2,3,4) and interval > 21""") getattr(gs, type + "Ease2") + getattr(gs, type + "Ease3") + getattr(gs, type + "Ease4")) - for e in range(enum): + setattr(gs, type + "Ease1", getattr(gs, type + "Ease0") + + getattr(gs, type + "Ease1")) + setattr(gs, type + "Ease0", -1) + for e in range(1, enum): try: arr[e+offset] = (getattr(gs, type + "Ease%d" % e) / float(total)) * 100 + 1 @@ -234,16 +237,16 @@ from cards where type = 1 and priority in (1,2,3,4) and interval > 21""") bars.append(graph.bar(range(arrsize), arr, width=1.0, color=colours[n], align='center')) arr = [0] * arrsize - offset += 6 + offset += 5 n += 1 graph.set_ylabel("%") - x = ([""] + [str(n) for n in range(enum)]) * 3 - del x[0] + x = ([""] + [str(n) for n in range(1, enum)]) * 3 graph.legend([p[0] for p in bars], (_("New cards"), _("Young cards"), _("Mature cards")), 'upper left') graph.set_ylim(ymax=100) + graph.set_xlim(xmax=15) graph.set_xticks(range(arrsize)) graph.set_xticklabels(x) graph.grid(True)