rating charts using highcharts
This commit is contained in:
parent
ed35ae66ac
commit
9016b894a1
|
@ -6,6 +6,9 @@
|
||||||
@highchartsTag
|
@highchartsTag
|
||||||
@highchartsMoreTag
|
@highchartsMoreTag
|
||||||
@jsTagCompiled("chart2.js")
|
@jsTagCompiled("chart2.js")
|
||||||
|
@info.ratingChart.map { ratingChart =>
|
||||||
|
@embedJs(s"var lichess_rating_series = $ratingChart;")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@showPerf(name: String, perf: lila.rating.Perf) = {
|
@showPerf(name: String, perf: lila.rating.Perf) = {
|
||||||
|
@ -27,6 +30,10 @@
|
||||||
@showPerf("standard", u.perfs.standard)
|
@showPerf("standard", u.perfs.standard)
|
||||||
@showPerf("chess960", u.perfs.chess960)
|
@showPerf("chess960", u.perfs.chess960)
|
||||||
<br />
|
<br />
|
||||||
|
@showPerf("bullet", u.perfs.bullet)
|
||||||
|
@showPerf("blitz", u.perfs.blitz)
|
||||||
|
@showPerf("slow", u.perfs.slow)
|
||||||
|
<br />
|
||||||
@u.perfs.pools.toList.sortBy(_._1).map {
|
@u.perfs.pools.toList.sortBy(_._1).map {
|
||||||
case (id, perf) => {
|
case (id, perf) => {
|
||||||
@poolSetups.get(id).map { setup =>
|
@poolSetups.get(id).map { setup =>
|
||||||
|
@ -37,10 +44,6 @@
|
||||||
@if(u.perfs.pools.nonEmpty) {
|
@if(u.perfs.pools.nonEmpty) {
|
||||||
<br />
|
<br />
|
||||||
}
|
}
|
||||||
@showPerf("bullet", u.perfs.bullet)
|
|
||||||
@showPerf("blitz", u.perfs.blitz)
|
|
||||||
@showPerf("slow", u.perfs.slow)
|
|
||||||
<br />
|
|
||||||
@showPerf("puzzle", u.perfs.puzzle)
|
@showPerf("puzzle", u.perfs.puzzle)
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
@ -139,7 +142,7 @@ openGraph = Map(
|
||||||
<div class="mod_zone"></div>
|
<div class="mod_zone"></div>
|
||||||
<div class="meat">
|
<div class="meat">
|
||||||
@info.ratingChart.map { ratingChart =>
|
@info.ratingChart.map { ratingChart =>
|
||||||
<div class="rating_history" title="Rating history" data-series="@ratingChart">
|
<div class="rating_history" title="Rating history">
|
||||||
<span>Chart loading…</span>
|
<span>Chart loading…</span>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,25 +43,4 @@ final class HistoryApi(coll: Coll) {
|
||||||
|
|
||||||
def get(userId: String): Fu[Option[History]] =
|
def get(userId: String): Fu[Option[History]] =
|
||||||
coll.find(BSONDocument("_id" -> userId)).one[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
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,15 +35,17 @@ $(function() {
|
||||||
title: noText,
|
title: noText,
|
||||||
xAxis: {
|
xAxis: {
|
||||||
type: 'datetime',
|
type: 'datetime',
|
||||||
labels: disabled,
|
labels: {
|
||||||
lineWidth: 0,
|
enabled: true
|
||||||
tickWidth: 0,
|
},
|
||||||
gridLineWidth: 0
|
lineWidth: 1,
|
||||||
|
tickWidth: 1,
|
||||||
|
gridLineWidth: 1
|
||||||
},
|
},
|
||||||
yAxis: {
|
yAxis: {
|
||||||
gridLineWidth: 0,
|
gridLineWidth: 1,
|
||||||
labels: {
|
labels: {
|
||||||
enabled: false,
|
enabled: true,
|
||||||
x: 0,
|
x: 0,
|
||||||
style: {
|
style: {
|
||||||
font: Highcharts.makeFont(10),
|
font: Highcharts.makeFont(10),
|
||||||
|
@ -66,7 +68,7 @@ $(function() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
series: _.map($(this).data('series'), function(serie) {
|
series: _.map(lichess_rating_series, function(serie) {
|
||||||
return {
|
return {
|
||||||
name: serie.name,
|
name: serie.name,
|
||||||
type: 'line',
|
type: 'line',
|
||||||
|
|
|
@ -59,12 +59,9 @@ div.sub_ratings h3 {
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
div.user_show .rating_history {
|
div.user_show .rating_history {
|
||||||
position: absolute;
|
margin-left: -15px;
|
||||||
top: -10px;
|
width: 100%;
|
||||||
left: -15px;
|
height: 250px;
|
||||||
display: block;
|
|
||||||
width: 479px;
|
|
||||||
height: 350px;
|
|
||||||
}
|
}
|
||||||
div.user_show .rating_history span {
|
div.user_show .rating_history span {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
@ -72,9 +69,6 @@ div.user_show .rating_history span {
|
||||||
left: 232px;
|
left: 232px;
|
||||||
}
|
}
|
||||||
div.user_show .user-infos {
|
div.user_show .user-infos {
|
||||||
position: absolute;
|
|
||||||
top: 0;
|
|
||||||
left: 449px;
|
|
||||||
padding: 0 16px;
|
padding: 0 16px;
|
||||||
border-left: 1px solid #c0c0c0;
|
border-left: 1px solid #c0c0c0;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
|
Loading…
Reference in a new issue