]> git.xonotic.org Git - xonotic/xonstat.git/commitdiff
Limit data points shown via JSON, not slice().
authorAnt Zucaro <azucaro@gmail.com>
Wed, 10 Dec 2014 00:04:14 +0000 (19:04 -0500)
committerAnt Zucaro <azucaro@gmail.com>
Wed, 10 Dec 2014 00:04:14 +0000 (19:04 -0500)
xonstat/static/js/weaponCharts.js
xonstat/templates/player_info.mako

index 57605568d0b534b049ab1f24e1b33449598bae9a..4c1e8e834ebedaffc924a88843225cc0fdaeb97d 100644 (file)
@@ -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,
index ce916b7c0e9f9b1b11afa6a5e0b5c0d9681169d1..21a7490f5a30a26af7ba8cfa29632b9716b63c6e 100644 (file)
@@ -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);
   });