//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 true, // game-types false, // dates+builds ], }; var reportOptions = { restEndpoint: config.weaponModPurchases, restEndpointAsync: config.weaponModPurchasesAsync, processFunction: formatData, multipleRequests: generateEndpoints, hasFriendlierNames: true, description: "", chartGroups: { getGroups: function(d) {return d}, // Data are returned grouped getGroupName: function(d) { return (($("#friendlier-names").is(":checked") && d.WeaponFriendlyName) ? d.WeaponFriendlyName : d.WeaponName); }, getGroupValues: function(d) {return d.WeaponMods}, }, bars: [ { title: "Percentage of Users Purchased", colour: config.chartColour1, getName: function(d) { return ($("#friendlier-names").is(":checked") && d.WeaponModFriendlyName) ? d.WeaponModFriendlyName : d.WeaponModName; }, getValue: function(d) { return (d.OnlineGamers) ? (commasFixed2((d.UniqueGamers/d.OnlineGamers)*100)) : commasFixed2(0); }, getObject: function(d) {return d}, }, ], tooltipContent: function(key, x, y, e, graph) { var html = "

" + x + "


" + "" + "" + "" + "" + "" + ""; html += "
" + key + ": " + commasFixed2(Number(e.value)) + " %
Times Purchased: " + commasFixed2(e.point.Object.TimesPurchased) + "
Total Spent: $ " + commasFixed2(e.point.Object.TotalSpent) + "
Unique Gamers: " + commasFixed2(e.point.Object.UniqueGamers) + "
Online Gamers: " + commasFixed2(e.point.Object.OnlineGamers) + "
"; return html; }, yTickFormat: function(d) { return commasFixed2(Number(d)); }, units: "Users (%)", chartLeftMargin: 185, }; function generateEndpoints(pValues) { // store the obj to local for processing the results //requestPValues = pValues; var endpointObjects = [ { restUrl: config.restHost + reportOptions.restEndpoint, restAsyncUrl: config.restHost + reportOptions.restEndpointAsync + pValues.ForceUrlSuffix, pValues: [pValues], }, { restUrl: config.restHost + config.onlineGamerCount, restAsyncUrl: config.restHost + config.onlineGamerCountAsync + pValues.ForceUrlSuffix, pValues: [pValues], }, ]; return endpointObjects; } function formatData(data) { return data[0][0].response.map(function(d) { d.WeaponMods = d.WeaponMods.map(function(w) { w["OnlineGamers"] = data[1][0].response; return w; }); return d; }); } //Friendly names by default //$("#friendlier-names").prop("checked", true);