<%block name="js">
${parent.js()}
-<script src="/static/js/d3.v3.min.js"></script>
<script type="text/javascript" src="https://www.google.com/jsapi?autoload={'modules':[{'name':'visualization','version':'1','packages':['corechart']}]}"></script>
<script src="/static/js/weaponCharts.js"></script>
-
<script type="text/javascript">
+
// tabs
$(function () {
$('#gbtab li').click(function(e) {
// weapon accuracy and damage charts
google.load('visualization', '1.1', {packages: ['corechart']});
-d3.json("${request.route_url('player_weaponstats_data_json', id=player.player_id, _query={'limit':20})}", function(err, data) {
+$.getJSON("${request.route_url('player_weaponstats_data_json', id=player.player_id, _query={'limit':20})}", function(data) {
if(data.games.length < 5) {
d3.select(".row #damageChart").remove();
d3.select(".row #accuracyChart").remove();
drawAccuracyChart(data);
});
+
+// game type buttons
% for g in games_played:
-d3.select('.tab-${g.game_type_cd}').on("click", function() {
- // have to remove the chart each time
- d3.select('#damageChartSVG .nvd3').remove();
- d3.select('#accuracyChartSVG .nvd3').remove();
- d3.json("${request.route_url('player_weaponstats_data_json', id=player.player_id, _query={'limit':20, 'game_type':g.game_type_cd})}", function(err, data) {
+$('.tab-${g.game_type_cd}').click(function() {
+ $.getJSON("${request.route_url('player_weaponstats_data_json', id=player.player_id, _query={'limit':20, 'game_type':g.game_type_cd})}", function(data) {
drawDamageChart(data);
drawAccuracyChart(data);
});
});
% endfor
-
</script>
<script src="https://login.persona.org/include.js" type="text/javascript"></script>
<script type="text/javascript">${request.persona_js}</script>