fix selective on some graphs; tweak pie layout

This commit is contained in:
Damien Elmes 2011-03-30 21:11:03 +09:00
parent 2d8faa8608
commit b47275599b

View file

@ -46,7 +46,7 @@ class Graphs(object):
h1 { margin-bottom: 0; margin-top: 1em; } h1 { margin-bottom: 0; margin-top: 1em; }
body { font-size: 14px; } body { font-size: 14px; }
table * { font-size: 14px; } table * { font-size: 14px; }
.pielabel { text-align:center; padding:2px; color:black; } .pielabel { text-align:center; padding:2px; color:white; }
</style> </style>
""" """
@ -405,8 +405,7 @@ sum(case when queue=2 and ivl >= 21 then 1 else 0 end), -- mtr
sum(case when queue=1 or (queue=2 and ivl < 21) then 1 else 0 end), -- yng/lrn sum(case when queue=1 or (queue=2 and ivl < 21) then 1 else 0 end), -- yng/lrn
sum(case when queue=0 then 1 else 0 end), -- new sum(case when queue=0 then 1 else 0 end), -- new
sum(case when queue=-1 then 1 else 0 end) -- susp sum(case when queue=-1 then 1 else 0 end) -- susp
%s from cards where 1 %s""" % self._limit())
from cards""" % self._limit())
# Tools # Tools
###################################################################### ######################################################################
@ -443,11 +442,11 @@ from cards""" % self._limit())
ylabel = "" ylabel = ""
conf['series']['pie'] = dict( conf['series']['pie'] = dict(
show=True, show=True,
radius=0.8, radius=1,
stroke=dict(color="#000", width=3), stroke=dict(color="#fff", width=5),
label=dict( label=dict(
show=True, show=True,
radius=1, radius=0.7,
threshold=0.01)) threshold=0.01))
#conf['legend'] = dict(show=False) #conf['legend'] = dict(show=False)
@ -471,7 +470,7 @@ $(function () {
} }
if (conf.series.pie) { if (conf.series.pie) {
conf.series.pie.label.formatter = function(label, series){ conf.series.pie.label.formatter = function(label, series){
return '<div class=pielabel>'+'<small>'+label+'</small><br>'+Math.round(series.percent)+'%%</div>'; return '<div class=pielabel>'+Math.round(series.percent)+'%%</div>';
}; };
} }
$.plot($("#%(id)s"), %(data)s, conf); $.plot($("#%(id)s"), %(data)s, conf);