From: Ant Zucaro Date: Sat, 6 Jun 2015 13:13:46 +0000 (-0400) Subject: Remove the rifle from the damage and accuracy charts. X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=ca02e0ad79ed49f967fd0cc234ce7fd937a9f133;p=xonotic%2Fxonstat.git Remove the rifle from the damage and accuracy charts. --- diff --git a/xonstat/static/js/weaponCharts.js b/xonstat/static/js/weaponCharts.js index 8b3d64a..e2a50a2 100644 --- a/xonstat/static/js/weaponCharts.js +++ b/xonstat/static/js/weaponCharts.js @@ -79,8 +79,6 @@ function drawAccuracyChart(weaponData) { data.addColumn({type: 'string', role: 'tooltip'}); data.addColumn('number', 'Vaporizer'); data.addColumn({type: 'string', role: 'tooltip'}); - data.addColumn('number', 'Rifle'); - data.addColumn({type: 'string', role: 'tooltip'}); data.addColumn('number', 'Arc'); data.addColumn({type: 'string', role: 'tooltip'}); @@ -96,13 +94,11 @@ function drawAccuracyChart(weaponData) { var vortexTT = accuracyTooltip("vortex", vortex, weaponData.averages); var mn = accuracyValue(flattened[game_id], "vaporizer"); var mnTT = accuracyTooltip("vaporizer", mn, weaponData.averages); - var rifle = accuracyValue(flattened[game_id], "rifle"); - var rifleTT = accuracyTooltip("rifle", rifle, weaponData.averages); var arc = accuracyValue(flattened[game_id], "arc"); var arcTT = accuracyTooltip("arc", arc, weaponData.averages); data.addRow([game_id.toString(), sg, sgTT, mg, mgTT, vortex, - vortexTT, mn, mnTT, rifle, rifleTT, arc, arcTT]); + vortexTT, mn, mnTT, arc, arcTT]); } var options = { @@ -130,8 +126,7 @@ function drawAccuracyChart(weaponData) { 1: { color: weaponColors["machinegun"] }, 2: { color: weaponColors["vortex"] }, 3: { color: weaponColors["vaporizer"] }, - 4: { color: weaponColors["rifle"] }, - 5: { color: weaponColors["arc"] } + 4: { color: weaponColors["arc"] } } }; @@ -177,8 +172,6 @@ function drawDamageChart(weaponData) { data.addColumn({type: 'string', role: 'tooltip'}); data.addColumn('number', 'Vortex'); data.addColumn({type: 'string', role: 'tooltip'}); - data.addColumn('number', 'Rifle'); - data.addColumn({type: 'string', role: 'tooltip'}); data.addColumn('number', 'Mortar'); data.addColumn({type: 'string', role: 'tooltip'}); data.addColumn('number', 'Electro'); @@ -204,8 +197,6 @@ function drawDamageChart(weaponData) { var vortexTT = damageTooltip("vortex", vortex); var mn = damageValue(flattened[game_id], "vaporizer"); var mnTT = damageTooltip("vaporizer", mn); - var rifle = damageValue(flattened[game_id], "rifle"); - var rifleTT = damageTooltip("rifle", rifle); var mortar = damageValue(flattened[game_id], "mortar"); var mortarTT = damageTooltip("mortar", mortar); var electro = damageValue(flattened[game_id], "electro"); @@ -224,7 +215,6 @@ function drawDamageChart(weaponData) { sg, sgTT, mg, mgTT, vortex, vortexTT, - rifle, rifleTT, mortar, mortarTT, electro, electroTT, crylink, crylinkTT, @@ -257,7 +247,6 @@ function drawDamageChart(weaponData) { 0: { color: weaponColors["shotgun"] }, 1: { color: weaponColors["machinegun"] }, 2: { color: weaponColors["vortex"] }, - 3: { color: weaponColors["rifle"] }, 4: { color: weaponColors["mortar"] }, 5: { color: weaponColors["electro"] }, 6: { color: weaponColors["crylink"] }, diff --git a/xonstat/static/js/weaponCharts.min.js b/xonstat/static/js/weaponCharts.min.js index 2cbc2d3..f8ce39b 100644 --- a/xonstat/static/js/weaponCharts.min.js +++ b/xonstat/static/js/weaponCharts.min.js @@ -1 +1 @@ -var weaponColors={arc:"#b8e9ff",laser:"#ff5933",blaster:"#ff5933",shotgun:"#1f77b4",uzi:"#b9e659",machinegun:"#b9e659",grenadelauncher:"#ff2600",mortar:"#ff2600",minelayer:"#bfbf00",electro:"#597fff",crylink:"#d940ff",nex:"#00e6ff",vortex:"#00e6ff",hagar:"#d98059",rocketlauncher:"#ffbf33",devastator:"#ffbf33",porto:"#7fff7f",minstanex:"#d62728",vaporizer:"#d62728",hook:"#a5ffd8",hlac:"#ffa533",seeker:"#ff5959",rifle:"#9467bd",tuba:"#d87f3f",fireball:"#33ff33"};var flatten=function(a){flattened={};a.games.forEach(function(c,b){flattened[c]={}});a.weapon_stats.forEach(function(c,b){flattened[c.game_id][c.weapon_cd]=c});return flattened};function accuracyValue(b,c){if(b[c]==undefined){return null}var a=b[c];var d=a.fired>0?Math.round((a.hit/a.fired)*100):0;return d}function accuracyTooltip(b,d,a){if(d==null){return null}var c=b+": "+d.toString()+"%";if(a[b]!=undefined){return c+" ("+a[b].toString()+"% average)"}return c}function drawAccuracyChart(j){var t=new google.visualization.DataTable();t.addColumn("string","X");t.addColumn("number","Shotgun");t.addColumn({type:"string",role:"tooltip"});t.addColumn("number","MG");t.addColumn({type:"string",role:"tooltip"});t.addColumn("number","Vortex");t.addColumn({type:"string",role:"tooltip"});t.addColumn("number","Vaporizer");t.addColumn({type:"string",role:"tooltip"});t.addColumn("number","Rifle");t.addColumn({type:"string",role:"tooltip"});t.addColumn("number","Arc");t.addColumn({type:"string",role:"tooltip"});var k=flatten(j);for(i in j.games){var h=j.games[i];var r=accuracyValue(k[h],"shotgun");var q=accuracyTooltip("shotgun",r,j.averages);var p=accuracyValue(k[h],"machinegun");var b=accuracyTooltip("machinegun",p,j.averages);var s=accuracyValue(k[h],"vortex");var f=accuracyTooltip("vortex",s,j.averages);var n=accuracyValue(k[h],"vaporizer");var o=accuracyTooltip("vaporizer",n,j.averages);var a=accuracyValue(k[h],"rifle");var l=accuracyTooltip("rifle",a,j.averages);var d=accuracyValue(k[h],"arc");var e=accuracyTooltip("arc",d,j.averages);t.addRow([h.toString(),r,q,p,b,s,f,n,o,a,l,d,e])}var c={backgroundColor:{fill:"transparent"},lineWidth:2,legend:{textStyle:{color:"#666"}},hAxis:{title:"Games",textPosition:"none",titleTextStyle:{color:"#666"}},vAxis:{title:"Percentage",titleTextStyle:{color:"#666"},minValue:0,maxValue:100,baselineColor:"#333",gridlineColor:"#333",ticks:[20,40,60,80,100]},series:{0:{color:weaponColors.shotgun},1:{color:weaponColors.machinegun},2:{color:weaponColors.vortex},3:{color:weaponColors.vaporizer},4:{color:weaponColors.rifle},5:{color:weaponColors.arc}}};var g=new google.visualization.LineChart(document.getElementById("accuracyChart"));var m=function(w){var v=g.getSelection()[0];if(v!=null&&v.row!=null){var u=t.getFormattedValue(v.row,0);window.location.href="http://stats.xonotic.org/game/"+u.toString()}};google.visualization.events.addListener(g,"select",m);g.draw(t,c)}function damageValue(a,b){if(a[b]==undefined){return null}return a[b].actual}function damageTooltip(b,a){if(a==null){return null}return b+": "+a.toString()+" HP damage"}function drawDamageChart(s){var D=new google.visualization.DataTable();D.addColumn("string","X");D.addColumn("number","Shotgun");D.addColumn({type:"string",role:"tooltip"});D.addColumn("number","Machine Gun");D.addColumn({type:"string",role:"tooltip"});D.addColumn("number","Vortex");D.addColumn({type:"string",role:"tooltip"});D.addColumn("number","Rifle");D.addColumn({type:"string",role:"tooltip"});D.addColumn("number","Mortar");D.addColumn({type:"string",role:"tooltip"});D.addColumn("number","Electro");D.addColumn({type:"string",role:"tooltip"});D.addColumn("number","Crylink");D.addColumn({type:"string",role:"tooltip"});D.addColumn("number","Hagar");D.addColumn({type:"string",role:"tooltip"});D.addColumn("number","Devastator");D.addColumn({type:"string",role:"tooltip"});D.addColumn("number","Arc");D.addColumn({type:"string",role:"tooltip"});var u=flatten(s);for(i in s.games){var r=s.games[i];var B=damageValue(u[r],"shotgun");var A=damageTooltip("shotgun",B);var z=damageValue(u[r],"machinegun");var b=damageTooltip("machinegun",z);var C=damageValue(u[r],"vortex");var o=damageTooltip("vortex",C);var w=damageValue(u[r],"vaporizer");var y=damageTooltip("vaporizer",w);var a=damageValue(u[r],"rifle");var v=damageTooltip("rifle",a);var q=damageValue(u[r],"mortar");var t=damageTooltip("mortar",q);var j=damageValue(u[r],"electro");var h=damageTooltip("electro",j);var c=damageValue(u[r],"crylink");var d=damageTooltip("crylink",c);var f=damageValue(u[r],"hagar");var l=damageTooltip("hagar",f);var m=damageValue(u[r],"devastator");var n=damageTooltip("devastator",m);var g=damageValue(u[r],"arc");var k=damageTooltip("arc",g);D.addRow([r.toString(),B,A,z,b,C,o,a,v,q,t,j,h,c,d,f,l,m,n,g,k])}var e={backgroundColor:{fill:"transparent"},legend:{position:"top",maxLines:3,textStyle:{color:"#666"}},vAxis:{title:"HP Damage",titleTextStyle:{color:"#666"},baselineColor:"#333",gridlineColor:"#333",},hAxis:{title:"Games",textPosition:"none",titleTextStyle:{color:"#666"},},isStacked:true,series:{0:{color:weaponColors.shotgun},1:{color:weaponColors.machinegun},2:{color:weaponColors.vortex},3:{color:weaponColors.rifle},4:{color:weaponColors.mortar},5:{color:weaponColors.electro},6:{color:weaponColors.crylink},7:{color:weaponColors.hagar},8:{color:weaponColors.devastator},9:{color:weaponColors.arc}}};var p=new google.visualization.ColumnChart(document.getElementById("damageChart"));var x=function(G){var F=p.getSelection()[0];if(F!=null&&F.row!=null){var E=D.getFormattedValue(F.row,0);window.location.href="http://stats.xonotic.org/game/"+E.toString()}};google.visualization.events.addListener(p,"select",x);p.draw(D,e)}; \ No newline at end of file +var weaponColors={arc:"#b8e9ff",laser:"#ff5933",blaster:"#ff5933",shotgun:"#1f77b4",uzi:"#b9e659",machinegun:"#b9e659",grenadelauncher:"#ff2600",mortar:"#ff2600",minelayer:"#bfbf00",electro:"#597fff",crylink:"#d940ff",nex:"#00e6ff",vortex:"#00e6ff",hagar:"#d98059",rocketlauncher:"#ffbf33",devastator:"#ffbf33",porto:"#7fff7f",minstanex:"#d62728",vaporizer:"#d62728",hook:"#a5ffd8",hlac:"#ffa533",seeker:"#ff5959",rifle:"#9467bd",tuba:"#d87f3f",fireball:"#33ff33"};var flatten=function(a){flattened={};a.games.forEach(function(c,b){flattened[c]={}});a.weapon_stats.forEach(function(c,b){flattened[c.game_id][c.weapon_cd]=c});return flattened};function accuracyValue(b,c){if(b[c]==undefined){return null}var a=b[c];var d=a.fired>0?Math.round((a.hit/a.fired)*100):0;return d}function accuracyTooltip(b,d,a){if(d==null){return null}var c=b+": "+d.toString()+"%";if(a[b]!=undefined){return c+" ("+a[b].toString()+"% average)"}return c}function drawAccuracyChart(c){var e=new google.visualization.DataTable();e.addColumn("string","X");e.addColumn("number","Shotgun");e.addColumn({type:"string",role:"tooltip"});e.addColumn("number","MG");e.addColumn({type:"string",role:"tooltip"});e.addColumn("number","Vortex");e.addColumn({type:"string",role:"tooltip"});e.addColumn("number","Vaporizer");e.addColumn({type:"string",role:"tooltip"});e.addColumn("number","Arc");e.addColumn({type:"string",role:"tooltip"});var q=flatten(c);for(i in c.games){var g=c.games[i];var j=accuracyValue(q[g],"shotgun");var h=accuracyTooltip("shotgun",j,c.averages);var m=accuracyValue(q[g],"machinegun");var a=accuracyTooltip("machinegun",m,c.averages);var o=accuracyValue(q[g],"vortex");var p=accuracyTooltip("vortex",o,c.averages);var d=accuracyValue(q[g],"vaporizer");var l=accuracyTooltip("vaporizer",d,c.averages);var b=accuracyValue(q[g],"arc");var f=accuracyTooltip("arc",b,c.averages);e.addRow([g.toString(),j,h,m,a,o,p,d,l,b,f])}var r={backgroundColor:{fill:"transparent"},lineWidth:2,legend:{textStyle:{color:"#666"}},hAxis:{title:"Games",textPosition:"none",titleTextStyle:{color:"#666"}},vAxis:{title:"Percentage",titleTextStyle:{color:"#666"},minValue:0,maxValue:100,baselineColor:"#333",gridlineColor:"#333",ticks:[20,40,60,80,100]},series:{0:{color:weaponColors.shotgun},1:{color:weaponColors.machinegun},2:{color:weaponColors.vortex},3:{color:weaponColors.vaporizer},4:{color:weaponColors.arc}}};var n=new google.visualization.LineChart(document.getElementById("accuracyChart"));var k=function(u){var t=n.getSelection()[0];if(t!=null&&t.row!=null){var s=e.getFormattedValue(t.row,0);window.location.href="http://stats.xonotic.org/game/"+s.toString()}};google.visualization.events.addListener(n,"select",k);n.draw(e,r)}function damageValue(a,b){if(a[b]==undefined){return null}return a[b].actual}function damageTooltip(b,a){if(a==null){return null}return b+": "+a.toString()+" HP damage"}function drawDamageChart(r){var B=new google.visualization.DataTable();B.addColumn("string","X");B.addColumn("number","Shotgun");B.addColumn({type:"string",role:"tooltip"});B.addColumn("number","Machine Gun");B.addColumn({type:"string",role:"tooltip"});B.addColumn("number","Vortex");B.addColumn({type:"string",role:"tooltip"});B.addColumn("number","Mortar");B.addColumn({type:"string",role:"tooltip"});B.addColumn("number","Electro");B.addColumn({type:"string",role:"tooltip"});B.addColumn("number","Crylink");B.addColumn({type:"string",role:"tooltip"});B.addColumn("number","Hagar");B.addColumn({type:"string",role:"tooltip"});B.addColumn("number","Devastator");B.addColumn({type:"string",role:"tooltip"});B.addColumn("number","Arc");B.addColumn({type:"string",role:"tooltip"});var t=flatten(r);for(i in r.games){var q=r.games[i];var z=damageValue(t[q],"shotgun");var y=damageTooltip("shotgun",z);var x=damageValue(t[q],"machinegun");var a=damageTooltip("machinegun",x);var A=damageValue(t[q],"vortex");var n=damageTooltip("vortex",A);var u=damageValue(t[q],"vaporizer");var w=damageTooltip("vaporizer",u);var p=damageValue(t[q],"mortar");var s=damageTooltip("mortar",p);var h=damageValue(t[q],"electro");var g=damageTooltip("electro",h);var b=damageValue(t[q],"crylink");var c=damageTooltip("crylink",b);var e=damageValue(t[q],"hagar");var k=damageTooltip("hagar",e);var l=damageValue(t[q],"devastator");var m=damageTooltip("devastator",l);var f=damageValue(t[q],"arc");var j=damageTooltip("arc",f);B.addRow([q.toString(),z,y,x,a,A,n,p,s,h,g,b,c,e,k,l,m,f,j])}var d={backgroundColor:{fill:"transparent"},legend:{position:"top",maxLines:3,textStyle:{color:"#666"}},vAxis:{title:"HP Damage",titleTextStyle:{color:"#666"},baselineColor:"#333",gridlineColor:"#333",},hAxis:{title:"Games",textPosition:"none",titleTextStyle:{color:"#666"},},isStacked:true,series:{0:{color:weaponColors.shotgun},1:{color:weaponColors.machinegun},2:{color:weaponColors.vortex},4:{color:weaponColors.mortar},5:{color:weaponColors.electro},6:{color:weaponColors.crylink},7:{color:weaponColors.hagar},8:{color:weaponColors.devastator},9:{color:weaponColors.arc}}};var o=new google.visualization.ColumnChart(document.getElementById("damageChart"));var v=function(E){var D=o.getSelection()[0];if(D!=null&&D.row!=null){var C=B.getFormattedValue(D.row,0);window.location.href="http://stats.xonotic.org/game/"+C.toString()}};google.visualization.events.addListener(o,"select",v);o.draw(B,d)}; \ No newline at end of file