// Grab the list of valid weapon heldtime profile stats - the variable name is weapons getScriptSync("/stats/js/configs/weapons_heldtime_list.js"); //set true for disabled filter var headerAndFilters = { headerType: "header-sc", // social club filtering header disabledFields: // disables header fields [ false, // platforms false, // locations false, // age false, // gamers false, // game-types false, // character [true, false, true], // dates+builds ], }; var weaponNamesMap = getWeaponStatnames(); var profStat = new ProfileStats(); //The types now will be added dynamically from the weapons endpoint var profileStatList = [ { types: weaponsHeldtime, requestSubString: "_HELDTIME", name: "Held Time", description: "Total held time per weapon", label: "Hours", unit: "hours", bucketSize: null, isWeaponStat: true, getName: getWeaponName, convertToHours: true, }, ]; var reportOptions = { restEndpoint: config.profileStatsCombinedDiff, restEndpointAsync: config.profileStatsCombinedDiffAsync, //restEndpoint: config.profileStatsCombined, //restEndpointAsync: config.profileStatsCombinedAsync, processFunction: formatData, availableCharts: profileStatList, multipleRequests: generateEndpoints, isClickable: false, hasFriendlierNames: true, enableCSVExport: "content-description", enablePNGExport: "content-description", // This is a piechart main: { title: profileStatList[0].name, legend: false, pieLabelsOutside: true, labelSunbeamLayout: false, donut: true, donutLabelsOutside: true, sortByValueDesc: true, getPieLabel: function(d) { return this.title; }, getValuesArray: function(d) { return d.values; }, getMetadata: function(d) {return d.metadata; }, // function to get the name from the rest data getName: function(d) { return getWeaponName(d.name);}, //getValue: function(d) { return d.total; }, getObject: function(d) { return d; }, lrMargin: 20, }, // This is the breakdown barchart breakdown: { title: profileStatList[0].name, legend: false, pieLabelsOutside: true, labelSunbeamLayout: false, donut: true, donutLabelsOutside: true, sortByValueDesc: true, getLabel: function(d) { return this.title; }, getColor: function(d) { return d.color; }, getValuesArray: function(d) {return d.values; }, getMetadata: function(d) {return d.metadata; }, // function to get the name from the rest data getName: function(d) { return getWeaponName(d.name); }, //getValue: function(d) { return d.total; }, getYLabel: function(d) { return profileStatList[0].label; }, matchColoursFromPieElement: "piechart", leftMargin: 120, getObject: function(d) { return d; }, }, } var radioButtonsPrefix = "weapons-radio"; function setReportOptions() { var label = $(":radio[name=" + radioButtonsPrefix + "]:checked + label").text(); var metric = $(":radio[name=" + radioButtonsPrefix + "]:checked").val().split("|")[0]; var unit = $(":radio[name=" + radioButtonsPrefix + "]:checked").val().split("|")[1]; reportOptions.main.title = label; //reportOptions.breakdown.title = "sdasd"; reportOptions.main.unit = " " + unit; //reportOptions.breakdown.unit = reportOptions.main.title; reportOptions.main.getValue = function(d) { return d[metric]; }; reportOptions.breakdown.getValue = reportOptions.main.getValue; } function addMetrics() { $("#content-description") .empty() .append( $("
") .attr("id", "content-description-radiometrics") .css("float", "left") .append( $("") .attr("type", "radio") .attr("name", radioButtonsPrefix) .attr("id", radioButtonsPrefix + "-1") .val("total|times") .attr("checked", true) ) .append( $("