summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorschneefux <schneefux+commit@schneefux.xyz>2017-01-15 23:11:37 +0100
committerschneefux <schneefux+commit@schneefux.xyz>2017-01-15 23:11:37 +0100
commitfcc4e3efc578aa4d721c5d8fc3c1e0f5b6b89589 (patch)
tree5a1c22a4f67d3ead288a07d061eeadc48dffd54a /examples
parent778e74bbf1f43b7703d1c3230a0a88b5c5f9f573 (diff)
downloadpython-gamelocker-fcc4e3efc578aa4d721c5d8fc3c1e0f5b6b89589.tar.gz
python-gamelocker-fcc4e3efc578aa4d721c5d8fc3c1e0f5b6b89589.zip
dashboard: fix, simplify and sort picks
Diffstat (limited to 'examples')
-rw-r--r--examples/dashboard/app.py9
-rw-r--r--examples/dashboard/templates/stats.js8
2 files changed, 2 insertions, 15 deletions
diff --git a/examples/dashboard/app.py b/examples/dashboard/app.py
index 036275e..35f6332 100644
--- a/examples/dashboard/app.py
+++ b/examples/dashboard/app.py
@@ -41,7 +41,6 @@ def data():
durations = dict()
players = dict()
heroes = dict()
- picks = dict()
sells = dict()
minions = 0
potions = 0
@@ -51,7 +50,6 @@ def data():
if match.gameMode not in gameModes:
gameModes[match.gameMode] = 0
durations[match.gameMode] = []
- picks[match.gameMode] = dict()
gameModes[match.gameMode] += 1
durations[match.gameMode] += [match.duration/60]
@@ -61,10 +59,6 @@ def data():
players[participant.player.name] = 0
players[participant.player.name] += 1
- if participant.actor.pretty() not in picks[match.gameMode]:
- picks[match.gameMode][participant.actor.pretty()] = 0
- picks[match.gameMode][participant.actor.pretty()] += 1
-
if participant.actor.pretty() not in heroes:
heroes[participant.actor.pretty()] = 0
heroes[participant.actor.pretty()] += 1
@@ -104,8 +98,9 @@ def data():
data["gameModes"] = [{"name": k, "y": v} for k, v in gameModes.items()]
data["durations"] = [{"name": k, "data": list(zip([list(durations.keys()).index(k)]*len(v), v))} for k, v in durations.items()]
- data["picks"] = [{"name": k, "data": list(v.values())} for k, v in picks.items()]
data["heroes"] = list(heroes.keys())
+ heroes = sorted(heroes.items(), key=lambda x: x[1], reverse=True)
+ data["picks"] = [{"name": k, "data": [v]} for k, v in heroes]
players = sorted(players.items(), key=lambda x: x[1], reverse=True)[:5]
data["players"] = [{"name": k, "data": [v]} for k, v in players]
diff --git a/examples/dashboard/templates/stats.js b/examples/dashboard/templates/stats.js
index 518bce8..5d69cd7 100644
--- a/examples/dashboard/templates/stats.js
+++ b/examples/dashboard/templates/stats.js
@@ -38,14 +38,6 @@ $(function () {
title: {
text: "Popular picks"
},
- plotOptions: {
- column: {
- stacking: "normal"
- }
- },
- xAxis: {
- categories: {{ stats.heroes|tojson|safe }}
- },
series: {{ stats.picks|tojson|safe }}
});
Highcharts.chart("durations", {