Skip to content

Commit

Permalink
improve game stats
Browse files Browse the repository at this point in the history
  • Loading branch information
ornicar committed Oct 29, 2012
1 parent eeeb1e8 commit f4321b6
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 18 deletions.
6 changes: 3 additions & 3 deletions app/analyse/TimePie.scala
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ import com.codahale.jerkson.Json
final class TimePie(val pov: Pov) {

def columns = Json generate List(
"string" :: "Move time" :: Nil,
"number" :: "Moves" :: Nil)
"string" :: "Time in seconds" :: Nil,
"number" :: "Number of moves" :: Nil)

def rows = Json generate {

import pov._

val steps = (0 to 5) ++ (6 to 12 by 2) ++ (15 to 30 by 3) ++ (35 to 60 by 5)
val steps = (0 to 1) ++ (2 to 6 by 2) ++ (10 to 20 by 5) ++ (20 to 60 by 10)

val ranges = steps zip (steps drop 1) map { case (a, b) Range(a, b) }

Expand Down
2 changes: 1 addition & 1 deletion app/templating/AssetHelper.scala
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import play.api.templates.Html

trait AssetHelper {

val assetVersion = 12
val assetVersion = 13

def cssTag(name: String) = css("stylesheets/" + name)

Expand Down
24 changes: 14 additions & 10 deletions app/views/analyse/stats.scala.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,21 @@ <h1 class="title">
Game <a href="@routes.Round.watcher(game.id, "white")">#@game.id</a> time stats
</h1>
<br /><br />
<div
class="move-time"
data-title="Time per move evolution"
data-columns="@timeChart.columns"
<div
class="move-time"
data-title="Time per move evolution"
data-columns="@timeChart.columns"
data-rows="@timeChart.rows"></div>
@timePies.map { pie =>
<div
class="move-times"
data-title="@userIdToUsername(pie.pov.player.userId)"
data-columns="@pie.columns"
data-rows="@pie.rows"></div>
<br /><br />
<div class="clearfix">
@timePies.map { pie =>
<div
class="move-times"
style="float:left;"
data-title="@pie.pov.color.name - @userIdToUsername(pie.pov.player.userId) move times"
data-columns="@pie.columns"
data-rows="@pie.rows"></div>
}
</div>
</div>
}
9 changes: 5 additions & 4 deletions public/javascripts/chart.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,12 @@ function drawCharts() {
var data = elemToData(this);
var chart = new google.visualization.PieChart(this);
chart.draw(data, {
width: 312,
height: 200,
titlePosition: 'none',
width: 366,
height: 300,
title: $(this).data('title'),
legend: {textStyle: textcolor},
chartArea:{left:"0%",width:"100%",height:"100%"},
titleTextStyle: textcolor,
chartArea:{left:"0%",width:"100%",height:"80%"},
is3D: true,
backgroundColor: bg
});
Expand Down

0 comments on commit f4321b6

Please sign in to comment.