")
.addClass("description")
.html(reportOptions.description)
)
}
if (reportOptions.enableCSVExport) {
$("#content-description")
.append(
$("
")
.attr("id", "content-description-controls")
.html(" ")
)
}
$("#filter").click(function() {
generateCharts();
});
generateCharts();
}
function generateCharts() {
// get the social club header filtering parameter values, headerAndFilters.headerType comes from local conf
var pValues = config.headerOptions[headerAndFilters.headerType].getParamValues();
if (!pValues)
return;
if (reportOptions.multipleRequests) {
var endpointsArray = reportOptions.multipleRequests(pValues);
var req = new ReportRequest(null, "json", null, config.restHost + config.reportsQueryAsync);
req.sendMultipleAsyncRequest(endpointsArray, drawCharts);
}
else {
if (reportOptions.hasExtraRestParams) {
$.each(reportOptions.hasExtraRestParams, function(i, paramObj) {
var value;
if (typeof paramObj.value === "function") {
value = paramObj.value();
}
else
value = paramObj.value;
pValues.Pairs[paramObj.key] = value;
});
}
var req = new ReportRequest(config.restHost + reportOptions.restEndpoint,
"json",
config.restHost + reportOptions.restEndpointAsync + pValues.ForceUrlSuffix,
config.restHost + config.reportsQueryAsync);
req.sendSingleAsyncRequest(pValues, drawCharts);
}
} // end of generateCharts()
function drawCharts(data) {
if (data) {
if (reportOptions.processFunction)
chartsData = reportOptions.processFunction(data);
else
chartsData = data;
}
if (chartsData.length == 0) {
//cleanGraph("single-barchart");
// clean all the previous charts
$("#content-body").find(".barchart").remove()
Sexy.alert(config.noDataText);
}
var filterText = $("#" + filterInputId).val();
if (filterText == defaultFilterText)
filterText = "";
var groups = reportOptions.chartGroups.getGroups(chartsData);
if (groups.length >= 2) {
// clean all the previous charts for many groups
$("#content-body").find("fieldset.barchart").remove();
}
$.each(groups, function(gindex, group) {
var groupName = reportOptions.chartGroups.getGroupName(group);
var groupValues = reportOptions.chartGroups.getGroupValues(group);
//Add the graph elements if they don't exist
if (!$("#" + barchartDOMIdPrefix + gindex).length) {
$("#content-body")
.append(
$("
")
.attr("id", barchartDOMIdPrefix + gindex)
.addClass("barchart")
)
if (groupName)
$("#" + barchartDOMIdPrefix + gindex)
.append(
$("