mirror of
https://github.com/ankitects/anki.git
synced 2025-09-19 06:22:22 -04:00
add 2nd y axis label
This commit is contained in:
parent
e3a848b5b8
commit
63872f51cd
1 changed files with 28 additions and 15 deletions
|
@ -160,9 +160,10 @@ table * { font-size: 14px; }
|
||||||
xaxis = dict(tickDecimals=0, min=-0.5)
|
xaxis = dict(tickDecimals=0, min=-0.5)
|
||||||
if end is not None:
|
if end is not None:
|
||||||
xaxis['max'] = end-0.5
|
xaxis['max'] = end-0.5
|
||||||
txt += self._graph(id="due", data=data, conf=dict(
|
txt += self._graph(id="due", data=data,
|
||||||
xaxis=xaxis,
|
ylabel2=_("Cumulative Cards"), conf=dict(
|
||||||
yaxes=[dict(), dict(tickDecimals=0, position="right")]))
|
xaxis=xaxis, yaxes=[dict(), dict(
|
||||||
|
tickDecimals=0, position="right")]))
|
||||||
txt += self._dueInfo(tot, len(totd)*chunk)
|
txt += self._dueInfo(tot, len(totd)*chunk)
|
||||||
return txt
|
return txt
|
||||||
|
|
||||||
|
@ -214,9 +215,9 @@ group by day order by day""" % (self._limit(), lim),
|
||||||
yaxes=[dict(), dict(position="right")])
|
yaxes=[dict(), dict(position="right")])
|
||||||
if days is not None:
|
if days is not None:
|
||||||
conf['xaxis']['min'] = -days-0.5
|
conf['xaxis']['min'] = -days-0.5
|
||||||
def plot(id, data, ylabel):
|
def plot(id, data, ylabel, ylabel2):
|
||||||
return self._graph(
|
return self._graph(
|
||||||
id, data=data, conf=conf, ylabel=ylabel)
|
id, data=data, conf=conf, ylabel=ylabel, ylabel2=ylabel2)
|
||||||
# reps
|
# reps
|
||||||
(repdata, repsum) = self._splitRepData(d, (
|
(repdata, repsum) = self._splitRepData(d, (
|
||||||
(3, colMature, _("Mature")),
|
(3, colMature, _("Mature")),
|
||||||
|
@ -226,7 +227,8 @@ group by day order by day""" % (self._limit(), lim),
|
||||||
(5, colCram, _("Cram"))))
|
(5, colCram, _("Cram"))))
|
||||||
txt = self._title(
|
txt = self._title(
|
||||||
reptitle, _("The number of questions you have answered."))
|
reptitle, _("The number of questions you have answered."))
|
||||||
txt += plot("reps", repdata, ylabel=_("Answers"))
|
txt += plot("reps", repdata, ylabel=_("Answers"), ylabel2=_(
|
||||||
|
"Cumulative Answers"))
|
||||||
(daysStud, fstDay) = self._daysStudied()
|
(daysStud, fstDay) = self._daysStudied()
|
||||||
txt += self._ansInfo(repsum, daysStud, fstDay, _("reviews"))
|
txt += self._ansInfo(repsum, daysStud, fstDay, _("reviews"))
|
||||||
|
|
||||||
|
@ -244,7 +246,7 @@ group by day order by day""" % (self._limit(), lim),
|
||||||
t = _("Hours")
|
t = _("Hours")
|
||||||
convHours = True
|
convHours = True
|
||||||
txt += self._title(timetitle, _("The time taken to answer the questions."))
|
txt += self._title(timetitle, _("The time taken to answer the questions."))
|
||||||
txt += plot("time", timdata, ylabel=t)
|
txt += plot("time", timdata, ylabel=t, ylabel2=_("Cumulative %s") % t)
|
||||||
txt += self._ansInfo(timsum, daysStud, fstDay, _("minutes"), convHours)
|
txt += self._ansInfo(timsum, daysStud, fstDay, _("minutes"), convHours)
|
||||||
return txt
|
return txt
|
||||||
|
|
||||||
|
@ -382,9 +384,9 @@ group by day order by day)""" % lim,
|
||||||
totd.append((grp, tot/float(all)*100))
|
totd.append((grp, tot/float(all)*100))
|
||||||
txt = self._title(_("Intervals"),
|
txt = self._title(_("Intervals"),
|
||||||
_("Delays until reviews are shown again."))
|
_("Delays until reviews are shown again."))
|
||||||
txt += self._graph(id="ivl", data=[
|
txt += self._graph(id="ivl", ylabel2=_("Deck Percentage"), data=[
|
||||||
dict(data=ivls, color=colIvl, label=_("All Types")),
|
dict(data=ivls, color=colIvl),
|
||||||
dict(data=totd, color=colCum, label=_("% Total"), yaxis=2,
|
dict(data=totd, color=colCum, yaxis=2,
|
||||||
bars={'show': False}, lines=dict(show=True), stack=False)
|
bars={'show': False}, lines=dict(show=True), stack=False)
|
||||||
], conf=dict(
|
], conf=dict(
|
||||||
xaxis=dict(min=-0.5, max=ivls[-1][0]+0.5),
|
xaxis=dict(min=-0.5, max=ivls[-1][0]+0.5),
|
||||||
|
@ -602,7 +604,7 @@ from cards where did in %s""" % self._limit())
|
||||||
######################################################################
|
######################################################################
|
||||||
|
|
||||||
def _graph(self, id, data, conf={},
|
def _graph(self, id, data, conf={},
|
||||||
type="bars", ylabel=_("Cards"), timeTicks=True):
|
type="bars", ylabel=_("Cards"), timeTicks=True, ylabel2=""):
|
||||||
# display settings
|
# display settings
|
||||||
if type == "pie":
|
if type == "pie":
|
||||||
conf['legend'] = {'container': "#%sLegend" % id, 'noColumns':2}
|
conf['legend'] = {'container': "#%sLegend" % id, 'noColumns':2}
|
||||||
|
@ -649,12 +651,23 @@ from cards where did in %s""" % self._limit())
|
||||||
"""
|
"""
|
||||||
<table cellpadding=0 cellspacing=10>
|
<table cellpadding=0 cellspacing=10>
|
||||||
<tr>
|
<tr>
|
||||||
<td><div style="width: 10px; -webkit-transform: rotate(-90deg);
|
|
||||||
-moz-transform: rotate(-90deg);">%(ylab)s</div></td>
|
<td><div style="width: 150px; text-align: center; position:absolute;
|
||||||
|
-webkit-transform: rotate(-90deg) translateY(-85px);
|
||||||
|
font-weight: bold;
|
||||||
|
">%(ylab)s</div></td>
|
||||||
|
|
||||||
<td>
|
<td>
|
||||||
<center><div id=%(id)sLegend></div></center>
|
<center><div id=%(id)sLegend></div></center>
|
||||||
<div id="%(id)s" style="width:%(w)s; height:%(h)s;"></div>
|
<div id="%(id)s" style="width:%(w)s; height:%(h)s;"></div>
|
||||||
</td></tr></table>
|
</td>
|
||||||
|
|
||||||
|
<td><div style="width: 150px; text-align: center; position:absolute;
|
||||||
|
-webkit-transform: rotate(90deg) translateY(65px);
|
||||||
|
font-weight: bold;
|
||||||
|
">%(ylab2)s</div></td>
|
||||||
|
|
||||||
|
</tr></table>
|
||||||
<script>
|
<script>
|
||||||
$(function () {
|
$(function () {
|
||||||
var conf = %(conf)s;
|
var conf = %(conf)s;
|
||||||
|
@ -672,7 +685,7 @@ $(function () {
|
||||||
});
|
});
|
||||||
</script>""" % dict(
|
</script>""" % dict(
|
||||||
id=id, w=width, h=height,
|
id=id, w=width, h=height,
|
||||||
ylab=ylabel,
|
ylab=ylabel, ylab2=ylabel2,
|
||||||
data=json.dumps(data), conf=json.dumps(conf)))
|
data=json.dumps(data), conf=json.dumps(conf)))
|
||||||
|
|
||||||
def _limit(self):
|
def _limit(self):
|
||||||
|
|
Loading…
Reference in a new issue