var graphType, statDefListJson; //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, // dates+builds ], }; function initPage() { // function from generic.js, variable from config file initHeaderAndFilters(headerAndFilters); // Post header filter addition $("#filter").click(function() { updateHtmlFields(); }); generateProfileStatList(); } function updateHtmlFields() { // make sure that at least one option is selected before updating the page html/graph if ($("select#stat-options").val() == null) return; var bucketInput = $("#bucket-options input[type=number]").val(); if (bucketInput == null || bucketInput == "" || isNaN(bucketInput) || parseInt(bucketInput) < 0) return; bucketInput = parseFloat(bucketInput); profileAjaxUri = config.restHost + config.profileStatPath + config.combinedPath; graphType = $("#graph-type input[name=graph-type-radio]:radio:checked").val(); var bucketSize, bucketCount; if ($("#bucket-options input[name=bucket-options-radio]:radio:checked").val() == "bucketSize") { bucketSize = bucketInput; bucketCount = 0; } else { bucketSize = 0 bucketCount = bucketInput; } var builds = ($("#build").val()) ? $("#build").val().join() : ""; var platforms = ($("#platform").val()) ? $("#platform").val().join() : ""; //var gameTypes = ($("#game-type").val()) ? $("#game-type").val().join() : ""; //var start = "\/Date(" + config.dateInputFormat.parse($("input#date-from").val()).getTime() + ")\/"; //var end = "\/Date(" + config.dateInputFormat.parse($("input#date-to").val()).getTime() + ")\/"; var start = new Date(config.dateInputFormat.parse($("input#date-from").val())).toISOString(); var end = new Date(config.dateInputFormat.parse($("input#date-to").val())).toISOString(); var pValue = { ElementKeyName: "Name", ElementValueName: "Value", Pairs: { "StatNames": $("select#stat-options").val().join(","), "BucketSize": bucketSize, "BucketCount": bucketCount, "PlatformNames": platforms, //"GameTypeNames": gameTypes, "StartDate": start, "EndDate": end, "BuildIdentifiers": builds, } }; var req = new ReportRequest(config.restHost + config.profileStatsCombined, "json", config.restHost + config.profileStatsCombinedAsync, config.restHost + config.reportsQueryAsync); req.sendSingleAsyncRequest(pValue, generateGraph); //generateGraph(); } function generateProfileStatList() { updateChartHeight(); block(); $.ajax({ url: config.restHost + config.profileStatDefPath, type: "GET", dataType: "json", success: function(json, textStatus, jqXHR) { statDefListJson = $(json.Items).sort(sortByIdentifierAsc); populateHtmlSelectOptions(statDefListJson, ""); }, error: function (xhr, ajaxOptions, thrownError) { alert(this.url + "\n" + ajaxOptions + " " + xhr.status + " " + thrownError ); }, complete: function() { unBlock(); } }); } function updateChartHeight() { var windowHeight = $("#content").height() - 20; $("#chart").css("height", windowHeight); } function populateHtmlSelectOptions(jsonItems, filterText) { var re = new RegExp(filterText, "i"); $.each(jsonItems, function(i, Item) { if (re.test(Item.Identifier)) { $("select#stat-options").append( $('