Chart updates work now. Had to recreate.
[xonotic/xonstat.git] / xonstat / templates / nvd3_damage.mako
1 <%inherit file="base.mako"/>
2 <%namespace name="nav" file="nav.mako" />
3
4 <%block name="navigation">
5 ${nav.nav('players')}
6 </%block>
7
8 <%block name="title">
9 Player Damage
10 </%block>
11
12 <%block name="css">
13 ${parent.css()}
14 <link href="/static/css/sprites.css" rel="stylesheet">
15 <link href="/static/css/nv.d3.css" rel="stylesheet" type="text/css">
16
17 <style>
18 #damageChartSVG {
19   height: 500px;
20 }
21 </style>
22 </%block>
23
24 <script src="/static/js/d3.v3.min.js"></script>
25
26 <%block name="js">
27 ${parent.js()}
28 <script src="/static/js/d3.v3.js"></script>
29 <script src="/static/js/nv.d3.min.js"></script>
30 <script src="/static/js/weaponCharts.js"></script>
31 <script>
32 % if game_type_cd is not None:
33     d3.json("${request.route_url('player_weaponstats_data_json', id=player_id, _query={'limit':limit, 'game_type':game_type_cd})}", drawDamageChart);
34 % else:
35     d3.json("${request.route_url('player_weaponstats_data_json', id=player_id, _query={'limit':limit})}", drawDamageChart);
36 % endif
37
38 % for gt in ('overall','duel','ctf','dm','tdm','ca','kh','ft','lms','as','dom','nb','cts','rc'):
39 d3.select('.sprite-${gt}').on("click", function() {
40   // have to remove the chart each time
41   d3.select('#damageChartSVG .nvd3').remove();
42   d3.json("${request.route_url('player_weaponstats_data_json', id=player_id, _query={'limit':limit, 'game_type':gt})}", drawDamageChart);
43 });
44 % endfor
45
46 </script>
47 </%block>
48
49 <div class="row">
50   <div class="span12">
51
52     <div id="damageChart">
53       <svg id="damageChartSVG"></svg>
54     </div>
55
56   </div> <!-- end span12 -->
57 </div> <!-- end row -->
58
59 ##### ROW OF GAME TYPE ICONS #####
60 <div class="row">
61   <div class="span12 tabbable">
62     <ul class="nav nav-tabs">
63       % for gt in ('overall','duel','ctf','dm','tdm','ca','kh','ft','lms','as','dom','nb','cts','rc'):
64       <li 
65       % if game_type_cd == gt or (game_type_cd is None and gt == 'overall'):
66       class="active"
67       % endif
68       >
69         <span class="sprite sprite-${gt}"> </span><br />
70         ${gt} <br />
71       </li>
72       % endfor
73     </ul>
74     <br />
75   </div>
76 </div>