Commit 2ae18124 authored by Lukas Burgey's avatar Lukas Burgey

Remove game value chart

parent 8b137f2b
......@@ -37,18 +37,6 @@
</table>
</div>
</div>
<div class="col-md-6">
<h5>Game endings: {{ win_percentage|floatformat:-2 }}% won</h5>
<div class="limitgrowth">
<canvas id="chart1"></canvas>
</div>
</div>
<div class="col-md-6">
<h5>Game count per type</h5>
<div class="limitgrowth">
<canvas id="chart0"></canvas>
</div>
</div>
<div class="col-md-12">
<h5>Win ratio per type</h5>
<div class="table-responsive">
......@@ -81,19 +69,22 @@
</div>
</div>
<div class="col-md-6">
<h5>{{ stat_descriptions|ldescr:'game_values' }}</h5>
<canvas id="chartgame_value"></canvas>
<h5>Game endings: {{ win_percentage|floatformat:-2 }}% won</h5>
<div class="limitgrowth">
<canvas id="chart1"></canvas>
</div>
</div>
<div class="col-md-6">
<h5>Average value by game ending</h5>
<canvas id="chart2"></canvas>
<h5>Game count per type</h5>
<div class="limitgrowth">
<canvas id="chart0"></canvas>
</div>
</div>
</div>
{% endblock %}
{% block script %}
<script>
var color_list = [{% for player in player_list %}"{{ player.color }}",{% endfor %}];
var dataSetsPointHistory = [
{% for player in player_list|dictsort:"stats.points" %}{
borderWidth: 3,
......@@ -106,18 +97,9 @@ var dataSetsPointHistory = [
data: [{% for point in player.stats.point_history %}{x:{{ forloop.counter0 }},y:{{ point }}},{% endfor %}],
},{% endfor %}
];
var dataSetsGameValues = [
{% for player in player_list|dictsort:"stats.points" %}{
label: "{{ player.name }}",
backgroundColor: "{{ player.color }}",
borderColor: "{{ player.color }}",
borderWidth: 3,
lineTension: 0,
pointRadius: 0.7,
fill: false,
data: [{% for datapoint in player.stats.game_values|dictsort:"value" %}{x:{{ datapoint.value }},y:{{ datapoint.count }},},{% endfor %}]
},{% endfor %}
];
scatterChart("#chartpoint_history", dataSetsPointHistory);
</script>
<script>
var dataSetsEloHistory = [
{% for player in player_list|dictsort:"stats.points" %}{
label: "{{ player.name }}",
......@@ -130,10 +112,9 @@ var dataSetsEloHistory = [
data: [{% for elo in player.stats.elo_history %}{x:{{ forloop.counter0 }},y:{{ elo }},},{% endfor %}]
},{% endfor %}
];
scatterChart("#chartpoint_history", dataSetsPointHistory);
scatterChart("#chartgame_value", dataSetsGameValues);
scatterChart("#chart_elo_history", dataSetsEloHistory);
</script>
<script>
// former typestats
var ctx = $("#chart0")[0].getContext("2d");
var schelleImg = new Image();
......@@ -193,12 +174,10 @@ $(window).on("load", function () {
}
});
});
</script>
<script>
// former overall
var ctx1 = document.getElementById("chart1").getContext("2d");
var ctx2 = document.getElementById("chart2").getContext("2d");
{% load static %}
var ctx1 = $("#chart1")[0].getContext("2d");
var winImg = new Image();
winImg.src = '{% static "skat/win.jpg" %}';
var loseImg = new Image();
......@@ -244,32 +223,6 @@ $(window).on("load", function () {
},
}
});
var typeChart = new Chart(ctx2, {
type: 'bar',
data: {
labels: [
{% for row in won_list %}label["{{ row.won }}"],
{% endfor %}],
datasets: [
{
borderColor: "#000000",
borderWidth: 1,
backgroundColor: [
{% for row in won_list %}pattern['{{ row.won }}'],
{% endfor %}],
data: [
{% for row in won_list %}"{{ row.avg }}",
{% endfor %}]
}
]
},
options: {
events: ["mousemove", "mouseenter"],
legend: {
display: false
},
}
});
});
</script>
{% endblock %}
......@@ -72,28 +72,27 @@ class PlayerStats(View):
context['player_list'] = models.overall_player_info()
return render(request, 'skat/playerstats1.html', context)
def stats_helper(context, it):
context['game_count_per_type'] = models.game_count_per_type(it)
context['best_player_per_type'] = models.best_player_per_type(it)
context['won_list'] = models.won_list(it)
context['win_percentage'] = models.Game.win_percentage(it)
class EventStats(View):
def get(self, request, **kwargs):
context = request_context(request)
context['title'] = "Stats: {}".format(context['it'])
context['game_count_per_type'] = models.game_count_per_type(context['it'])
context['best_player_per_type'] = models.best_player_per_type(context['it'])
context['won_list'] = models.won_list(context['it'])
context['win_percentage'] = models.Game.win_percentage(context['it'])
context['player_list'] = models.iteration_player_info(context['it'])
stats_helper(context, context['it'])
return render(request, 'skat/playerstats1.html', context)
class OverallStats(View):
def get(self, request, **kwargs):
context = request_context(request)
# Overall stats have no iteration, so we use None instead
context['title'] = "Stats: Overall"
context['game_count_per_type'] = models.game_count_per_type(None)
context['best_player_per_type'] = models.best_player_per_type(None)
context['won_list'] = models.won_list(None)
context['win_percentage'] = models.Game.win_percentage(None)
context['player_list'] = models.overall_player_info()
# Overall stats have no iteration, so we use None instead
stats_helper(context, None)
return render(request, 'skat/playerstats1.html', context)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment