summaryrefslogtreecommitdiff
path: root/examples/dashboard/templates/stats.js
blob: 5d69cd7954e51c5174b166091d0a3174927e6963 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
$(function () {
    $("#boots").text("{{ stats.boots }}");
    $("#potions").text("{{ stats.potions }}");
    $("#minions").text("{{ stats.minions }}");
    $("#topsold").text("{{ stats.topsold }}");
    $(".number").text("{{ stats.number }}");
    csstat = {{ stats.topcs|tojson|safe }};
    $("#cs-player").text(csstat.player);
    $("#cs-actor").text(csstat.actor);
    $("#cs-cs").text(csstat.cs);
    Highcharts.chart("gameType", {
        chart: {
            type: "pie"
        },
        title:  {
            text: "Game modes over the last {{ stats.number }} matches"
        },
        series: [{
            data: {{ stats.gameModes|tojson|safe }}
        }]
    });
    Highcharts.chart("players", {
        chart: {
            type: "bar"
        },
        xAxis: {
            categories: ["matches"]
        },
        title:  {
            text: "Most active players"
        },
        series: {{ stats.players|tojson|safe }}
    });
    Highcharts.chart("picks", {
        chart: {
            type: "column"
        },
        title:  {
            text: "Popular picks"
        },
        series: {{ stats.picks|tojson|safe }}
    });
    Highcharts.chart("durations", {
        chart: {
            type: "scatter"
        },
        yAxis: {
            title: {
                text: "length in minutes"
            }
        },
        xAxis: {
            labels: {
                enabled: false
            },
            tickInterval: 1,
            min: -0.5,
            max: 1.5
        },
        title:  {
            text: "Game durations"
        },
        series: {{ stats.durations|tojson|safe }}
    });

    $(".highcharts-credits").hide();
});