rating charts using highcharts

This commit is contained in:
Thibault Duplessis 2014-07-27 22:02:29 +02:00
parent ed35ae66ac
commit 9016b894a1
5 changed files with 24 additions and 42 deletions

View file

@ -6,6 +6,9 @@
@highchartsTag
@highchartsMoreTag
@jsTagCompiled("chart2.js")
@info.ratingChart.map { ratingChart =>
@embedJs(s"var lichess_rating_series = $ratingChart;")
}
}
@showPerf(name: String, perf: lila.rating.Perf) = {
@ -27,6 +30,10 @@
@showPerf("standard", u.perfs.standard)
@showPerf("chess960", u.perfs.chess960)
<br />
@showPerf("bullet", u.perfs.bullet)
@showPerf("blitz", u.perfs.blitz)
@showPerf("slow", u.perfs.slow)
<br />
@u.perfs.pools.toList.sortBy(_._1).map {
case (id, perf) => {
@poolSetups.get(id).map { setup =>
@ -37,10 +44,6 @@
@if(u.perfs.pools.nonEmpty) {
<br />
}
@showPerf("bullet", u.perfs.bullet)
@showPerf("blitz", u.perfs.blitz)
@showPerf("slow", u.perfs.slow)
<br />
@showPerf("puzzle", u.perfs.puzzle)
</div>
}
@ -139,7 +142,7 @@ openGraph = Map(
<div class="mod_zone"></div>
<div class="meat">
@info.ratingChart.map { ratingChart =>
<div class="rating_history" title="Rating history" data-series="@ratingChart">
<div class="rating_history" title="Rating history">
<span>Chart loading&#8230;</span>
</div>
}

View file

@ -43,25 +43,4 @@ final class HistoryApi(coll: Coll) {
def get(userId: String): Fu[Option[History]] =
coll.find(BSONDocument("_id" -> userId)).one[History]
// def set(userId: String, history: Iterable[HistoryEntry]): Funit =
// coll.insert(BSONDocument(
// "_id" -> userId,
// "e" -> BSONArray(history map write)
// )).void
// def addEntry(userId: String, entry: HistoryEntry): Funit =
// coll.update(
// BSONDocument("_id" -> userId),
// BSONDocument("$push" -> BSONDocument("e" -> write(entry))),
// upsert = true).void
// def create(perfs: Perfs) = coll.insert(BSONDocument(
// "_id" -> user.id,
// "e" -> BSONArray(write(HistoryEntry(
// DateTime.now,
// user.perfs.global.glicko.intRating,
// user.perfs.global.glicko.intDeviation,
// Glicko.default.intRating)))
// )).void
}

View file

@ -35,15 +35,17 @@ $(function() {
title: noText,
xAxis: {
type: 'datetime',
labels: disabled,
lineWidth: 0,
tickWidth: 0,
gridLineWidth: 0
labels: {
enabled: true
},
lineWidth: 1,
tickWidth: 1,
gridLineWidth: 1
},
yAxis: {
gridLineWidth: 0,
gridLineWidth: 1,
labels: {
enabled: false,
enabled: true,
x: 0,
style: {
font: Highcharts.makeFont(10),
@ -66,7 +68,7 @@ $(function() {
}
}
},
series: _.map($(this).data('series'), function(serie) {
series: _.map(lichess_rating_series, function(serie) {
return {
name: serie.name,
type: 'line',

View file

@ -59,12 +59,9 @@ div.sub_ratings h3 {
font-weight: bold;
}
div.user_show .rating_history {
position: absolute;
top: -10px;
left: -15px;
display: block;
width: 479px;
height: 350px;
margin-left: -15px;
width: 100%;
height: 250px;
}
div.user_show .rating_history span {
position: absolute;
@ -72,9 +69,6 @@ div.user_show .rating_history span {
left: 232px;
}
div.user_show .user-infos {
position: absolute;
top: 0;
left: 449px;
padding: 0 16px;
border-left: 1px solid #c0c0c0;
overflow: hidden;

4
todo
View file

@ -1 +1,5 @@
the todo list has moved to https://etherpad.mozilla.org/ep/pad/view/ro.3bIwxJwTQYW/latest
deploy
db.user4.dropIndex("progress_-1_enabled_1_perfs.global.nb_1")