mirror of
https://github.com/ankitects/anki.git
synced 2025-09-20 06:52:21 -04:00
hide the cumulative graph if datapoints < 2
This commit is contained in:
parent
74a52694ec
commit
c64c7a2acb
1 changed files with 13 additions and 8 deletions
|
@ -57,14 +57,18 @@ class Graphs(object):
|
||||||
mtr.append((day[0], day[2]))
|
mtr.append((day[0], day[2]))
|
||||||
tot += day[1]+day[2]
|
tot += day[1]+day[2]
|
||||||
totd.append((day[0], tot))
|
totd.append((day[0], tot))
|
||||||
txt = self._graph(id="due", title=_("Forecast"), data=[
|
data = [
|
||||||
dict(data=mtr, color=colMature, label=_("Mature")),
|
dict(data=mtr, color=colMature, label=_("Mature")),
|
||||||
dict(data=yng, color=colYoung, label=_("Young")),
|
dict(data=yng, color=colYoung, label=_("Young")),
|
||||||
|
]
|
||||||
|
if len(totd) > 1:
|
||||||
|
data.append(
|
||||||
dict(data=totd, color=colCum, label=_("Cumulative"), yaxis=2,
|
dict(data=totd, color=colCum, label=_("Cumulative"), yaxis=2,
|
||||||
bars={'show': False}, lines=dict(show=True), stack=False)
|
bars={'show': False}, lines=dict(show=True), stack=False))
|
||||||
], info=_("The number of reviews due in the future."), conf=dict(
|
txt = self._graph(id="due", title=_("Forecast"), data=data,
|
||||||
|
info=_("The number of reviews due in the future."), conf=dict(
|
||||||
xaxis=dict(tickDecimals=0),
|
xaxis=dict(tickDecimals=0),
|
||||||
yaxes=[dict(), dict(position="right")]))
|
yaxes=[dict(), dict(tickDecimals=0, position="right")]))
|
||||||
return txt
|
return txt
|
||||||
|
|
||||||
def _due(self, start=None, end=None, chunk=1):
|
def _due(self, start=None, end=None, chunk=1):
|
||||||
|
@ -155,6 +159,7 @@ Time spent answering cards."""))
|
||||||
ret = []
|
ret = []
|
||||||
for (n, col, lab) in spec:
|
for (n, col, lab) in spec:
|
||||||
ret.append(dict(data=sep[n], color=col, label=lab))
|
ret.append(dict(data=sep[n], color=col, label=lab))
|
||||||
|
if len(totd) > 1:
|
||||||
ret.append(dict(
|
ret.append(dict(
|
||||||
data=totd, color=colCum, label=_("Cumulative"), yaxis=2,
|
data=totd, color=colCum, label=_("Cumulative"), yaxis=2,
|
||||||
bars={'show': False}, lines=dict(show=True), stack=False))
|
bars={'show': False}, lines=dict(show=True), stack=False))
|
||||||
|
|
Loading…
Reference in a new issue