From: Ant Zucaro Date: Fri, 30 Aug 2019 01:59:05 +0000 (-0400) Subject: Update the weapon charts to match. X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=d9d5b83d1f516dc1706708c4349f5c2b5e684050;p=xonotic%2Fxonstat.git Update the weapon charts to match. --- diff --git a/xonstat/static/js/weaponCharts.js b/xonstat/static/js/weaponCharts.js index 3a0bf5c..d78ca3a 100644 --- a/xonstat/static/js/weaponCharts.js +++ b/xonstat/static/js/weaponCharts.js @@ -1,30 +1,30 @@ // Colors assigned to the various weapons 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" + "arc": "#7c9ceb", + "laser": "#f7717b", + "blaster": "#f7717b", + "shotgun": "#849ba8", + "uzi": "#81f13d", + "machinegun": "#81f13d", + "grenadelauncher": "#fd7865", + "mortar": "#fd7865", + "minelayer": "#fd7865", + "electro": "#6899f2", + "crylink": "#ea6ff9", + "nex": "#75c3d5", + "vortex": "#75c3d5", + "hagar": "#e39160", + "rocketlauncher": "#e9be57", + "devastator": "#e9be57", + "porto": "#6899f2", + "minstanex": "#978ed2", + "vaporizer": "#978ed2", + "hook": "#81f13d", + "hlac": "#e5965b", + "seeker": "#f7717b", + "rifle": "#e39160", + "tuba": "#e9be57", + "fireball": "#f0855f" }; // these weapons are used in the damage chart diff --git a/xonstat/static/js/weaponCharts.min.js b/xonstat/static/js/weaponCharts.min.js index 812926c..4c55305 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 damageWeapons=new Set(["vortex","machinegun","shotgun","arc","uzi","nex","minstanex","rifle","grenadelauncher","minelayer","rocketlauncher","hlac","seeker","fireball","mortar","electro","crylink","hagar","devastator"]);var accuracyWeapons=new Set(["vortex","machinegun","shotgun","vaporizer","arc","uzi","nex","minstanex","rifle"]);function drawAccuracyChart(f,a){var e={};a.games.forEach(function(g,h){e[g]=h});function d(g){return g.fired!=0}function c(g){return accuracyWeapons.has(g.weapon_cd)}var b=d3.nest().key(function(g){return g.weapon_cd}).entries(a.weapon_stats.filter(c).filter(d));nv.addGraph(function(){var g=nv.models.lineChart().useInteractiveGuideline(false).forceY([0,1]).showLegend(true).showYAxis(true).showXAxis(true).color(function(h){return weaponColors[h.key]}).x(function(h){return e[h.game_id]}).y(function(h){return h.fired>0?h.hit/h.fired:0});g.tooltip.contentGenerator(function(h,k,j,i){return"
"+h.point.weapon_cd+": "+Math.round(h.point.y*100)+"% ("+Math.round(a.averages[h.point.weapon_cd])+"% avg)
"});g.lines.dispatch.on("elementClick",function(h){window.location.href="http://stats.xonotic.org/game/"+h.point.game_id.toString()});g.yAxis.axisLabel("Accuracy").tickFormat(d3.format("2%"));g.xAxis.axisLabel("Games").tickFormat(function(h){return""});d3.select("#accuracyChartSVG").datum(b).call(g);nv.utils.windowResize(function(){g.update()});return g})}function drawDamageChart(e,b){var d={};b.games.forEach(function(f,g){d[f]=g});function a(f){return damageWeapons.has(f.weapon_cd)}var c=d3.nest().key(function(f){return f.weapon_cd}).entries(b.weapon_stats.filter(a));nv.addGraph(function(){var f=nv.models.multiBarChart().reduceXTicks(true).rotateLabels(0).showControls(true).groupSpacing(0.1).showXAxis(true).stacked(true).color(function(g){return weaponColors[g.key]}).x(function(g){return d[g.game_id]}).y(function(g){return g.actual});f.tooltip.contentGenerator(function(h,k,j,i){var g="
"+h.data.weapon_cd+": "+h.data.actual+" HP damage";if(h.data.frags>0){if(h.data.frags>1){g+=" ("+h.data.frags+" frags)"}else{g+=" ("+h.data.frags+" frag)"}}g+="
";return g});f.multibar.dispatch.on("elementClick",function(g){window.location.href="http://stats.xonotic.org/game/"+g.data.game_id.toString()});f.xAxis.axisLabel("Games").tickFormat(function(g){return""});f.yAxis.axisLabel("Damage (HP)").tickFormat(d3.format(",d"));d3.select("#damageChartSVG").datum(c).call(f);nv.utils.windowResize(f.update);return f})}; \ No newline at end of file +var weaponColors={arc:"#7c9ceb",laser:"#f7717b",blaster:"#f7717b",shotgun:"#849ba8",uzi:"#81f13d",machinegun:"#81f13d",grenadelauncher:"#fd7865",mortar:"#fd7865",minelayer:"#fd7865",electro:"#6899f2",crylink:"#ea6ff9",nex:"#75c3d5",vortex:"#75c3d5",hagar:"#e39160",rocketlauncher:"#e9be57",devastator:"#e9be57",porto:"#6899f2",minstanex:"#978ed2",vaporizer:"#978ed2",hook:"#81f13d",hlac:"#e5965b",seeker:"#f7717b",rifle:"#e39160",tuba:"#e9be57",fireball:"#f0855f"};var damageWeapons=new Set(["vortex","machinegun","shotgun","arc","uzi","nex","minstanex","rifle","grenadelauncher","minelayer","rocketlauncher","hlac","seeker","fireball","mortar","electro","crylink","hagar","devastator"]);var accuracyWeapons=new Set(["vortex","machinegun","shotgun","vaporizer","arc","uzi","nex","minstanex","rifle"]);function drawAccuracyChart(f,a){var e={};a.games.forEach(function(g,h){e[g]=h});function d(g){return g.fired!=0}function c(g){return accuracyWeapons.has(g.weapon_cd)}var b=d3.nest().key(function(g){return g.weapon_cd}).entries(a.weapon_stats.filter(c).filter(d));nv.addGraph(function(){var g=nv.models.lineChart().useInteractiveGuideline(false).forceY([0,1]).showLegend(true).showYAxis(true).showXAxis(true).color(function(h){return weaponColors[h.key]}).x(function(h){return e[h.game_id]}).y(function(h){return h.fired>0?h.hit/h.fired:0});g.tooltip.contentGenerator(function(h,k,j,i){return"
"+h.point.weapon_cd+": "+Math.round(h.point.y*100)+"% ("+Math.round(a.averages[h.point.weapon_cd])+"% avg)
"});g.lines.dispatch.on("elementClick",function(h){window.location.href="http://stats.xonotic.org/game/"+h.point.game_id.toString()});g.yAxis.axisLabel("Accuracy").tickFormat(d3.format("2%"));g.xAxis.axisLabel("Games").tickFormat(function(h){return""});d3.select("#accuracyChartSVG").datum(b).call(g);nv.utils.windowResize(function(){g.update()});return g})}function drawDamageChart(e,b){var d={};b.games.forEach(function(f,g){d[f]=g});function a(f){return damageWeapons.has(f.weapon_cd)}var c=d3.nest().key(function(f){return f.weapon_cd}).entries(b.weapon_stats.filter(a));nv.addGraph(function(){var f=nv.models.multiBarChart().reduceXTicks(true).rotateLabels(0).showControls(true).groupSpacing(0.1).showXAxis(true).stacked(true).color(function(g){return weaponColors[g.key]}).x(function(g){return d[g.game_id]}).y(function(g){return g.actual});f.tooltip.contentGenerator(function(h,k,j,i){var g="
"+h.data.weapon_cd+": "+h.data.actual+" HP damage";if(h.data.frags>0){if(h.data.frags>1){g+=" ("+h.data.frags+" frags)"}else{g+=" ("+h.data.frags+" frag)"}}g+="
";return g});f.multibar.dispatch.on("elementClick",function(g){window.location.href="http://stats.xonotic.org/game/"+g.data.game_id.toString()});f.xAxis.axisLabel("Games").tickFormat(function(g){return""});f.yAxis.axisLabel("Damage (HP)").tickFormat(d3.format(",d"));d3.select("#damageChartSVG").datum(c).call(f);nv.utils.windowResize(f.update);return f})}; \ No newline at end of file