From 601bffffce3790d702387ebda055d7b7ba86f003 Mon Sep 17 00:00:00 2001 From: Ant Zucaro Date: Tue, 9 Dec 2014 19:04:14 -0500 Subject: [PATCH] Limit data points shown via JSON, not slice(). --- xonstat/static/js/weaponCharts.js | 10 ++++++---- xonstat/templates/player_info.mako | 4 ++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/xonstat/static/js/weaponCharts.js b/xonstat/static/js/weaponCharts.js index 5760556..4c1e8e8 100644 --- a/xonstat/static/js/weaponCharts.js +++ b/xonstat/static/js/weaponCharts.js @@ -77,7 +77,7 @@ function drawAccuracyChart(weaponData) { var flattened = flatten(weaponData); - for(i in weaponData.games.slice(0,10)) { + for(i in weaponData.games) { var game_id = weaponData.games[i]; var sg = accuracyValue(flattened[game_id], "shotgun"); var sgTT = accuracyTooltip("shotgun", sg, weaponData.averages); @@ -101,7 +101,8 @@ function drawAccuracyChart(weaponData) { textStyle: { color: "#666" } }, hAxis: { - title: 'Game ID', + title: 'Games', + textPosition: 'none', titleTextStyle: { color: '#666' } }, vAxis: { @@ -179,7 +180,7 @@ function drawDamageChart(weaponData) { var flattened = flatten(weaponData); - for(i in weaponData.games.slice(0,10)) { + for(i in weaponData.games) { var game_id = weaponData.games[i]; var sg = damageValue(flattened[game_id], "shotgun"); var sgTT = damageTooltip("shotgun", sg); @@ -230,7 +231,8 @@ function drawDamageChart(weaponData) { gridlineColor: '#333', }, hAxis: { - title: 'Game ID', + title: 'Games', + textPosition: 'none', titleTextStyle: { color: '#666' }, }, isStacked: true, diff --git a/xonstat/templates/player_info.mako b/xonstat/templates/player_info.mako index ce916b7..21a7490 100644 --- a/xonstat/templates/player_info.mako +++ b/xonstat/templates/player_info.mako @@ -40,7 +40,7 @@ $(function () { // 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':10})}", function(err, data) { +d3.json("${request.route_url('player_weaponstats_data_json', id=player.player_id, _query={'limit':20})}", function(err, data) { if(data.games.length < 5) { d3.select(".row #damageChart").remove(); d3.select(".row #accuracyChart").remove(); @@ -54,7 +54,7 @@ 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':10, 'game_type':g.game_type_cd})}", function(err, data) { + 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) { drawDamageChart(data); drawAccuracyChart(data); }); -- 2.39.2