PM 2787, 2997, 2999, 3001
This commit is contained in:
@@ -150,20 +150,66 @@ TimeSeriesPresenter.prototype.historicData = function (indicator, periodicity, i
|
||||
var graphData = [];
|
||||
$.each(data, function(index, originalObject) {
|
||||
var newObject = {datalabel: that.periodColumnName(periodicity, originalObject) + '/' + originalObject['YEAR'],
|
||||
value: originalObject.VALUE
|
||||
value: originalObject.VALUE,
|
||||
period: that.periodColumnName(periodicity, originalObject),
|
||||
year: originalObject.YEAR
|
||||
}
|
||||
graphData.push(newObject);
|
||||
});
|
||||
|
||||
for (var y = initYear; y <= endYear; y++) {
|
||||
var periodRunFrom = (y == initYear) ? initPeriod : 1;
|
||||
var periodRunTo = (y == endYear) ? endPeriod : that.periodsInAYear(periodicity);
|
||||
for (var p = periodRunFrom; p <= periodRunTo; p++) {
|
||||
console.log(y + "---" + p);
|
||||
var results = $.grep(graphData,
|
||||
function(obj) {
|
||||
return (obj.year == y && obj.period == p);
|
||||
});
|
||||
if (results.length == 0) {
|
||||
var newObject = { datalabel: p + '/' + y,
|
||||
value: 0,
|
||||
period: p,
|
||||
year: y
|
||||
};
|
||||
graphData.push(newObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
graphData = graphData.sort(function (a, b) {
|
||||
return (a.year * 10 + a.period * 1) - (b.year * 10 + b.period * 1);
|
||||
});
|
||||
requestFinished.resolve(graphData);
|
||||
});
|
||||
return requestFinished.promise();
|
||||
}
|
||||
|
||||
TimeSeriesPresenter.prototype.periodsInAYear = function (periodicity) {
|
||||
var retval = "";
|
||||
switch (periodicity * 1) {
|
||||
case this.helper.ReportingPeriodicityEnum.MONTH:
|
||||
retval = 12
|
||||
break;
|
||||
case this.helper.ReportingPeriodicityEnum.QUARTER:
|
||||
retval = 4;
|
||||
break;
|
||||
case this.helper.ReportingPeriodicityEnum.SEMESTER:
|
||||
retval = 2;
|
||||
break;
|
||||
case this.helper.ReportingPeriodicityEnum.YEAR:
|
||||
retval = 1;
|
||||
break;
|
||||
}
|
||||
if (retval == "") {
|
||||
throw new Error("The periodicity " + periodicity + " is not supported.");
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
TimeSeriesPresenter.prototype.periodColumnName = function (periodicity, object) {
|
||||
var retval = "";
|
||||
switch (periodicity*1) {
|
||||
switch (periodicity * 1) {
|
||||
case this.helper.ReportingPeriodicityEnum.MONTH:
|
||||
retval = object.MONTH;
|
||||
break;
|
||||
@@ -251,16 +297,16 @@ TimeSeriesPresenter.prototype.periodEndDate = function (periodicity, period, yea
|
||||
var retval = null;
|
||||
switch (periodicity * 1) {
|
||||
case this.helper.ReportingPeriodicityEnum.MONTH:
|
||||
retval = new Date(year, period, 0);
|
||||
retval = new Date(year, period, 0, 23,59,59);
|
||||
break;
|
||||
case this.helper.ReportingPeriodicityEnum.QUARTER:
|
||||
retval = new Date(year, 3 * (period), 0);
|
||||
retval = new Date(year, 3 * (period), 0, 23, 59, 59);
|
||||
break;
|
||||
case this.helper.ReportingPeriodicityEnum.SEMESTER:
|
||||
retval = new Date(year, 6 * (period), 0);
|
||||
retval = new Date(year, 6 * (period), 0, 23, 59, 59);
|
||||
break;
|
||||
case this.helper.ReportingPeriodicityEnum.YEAR:
|
||||
retval = new Date(year, 11, 31);
|
||||
retval = new Date(year, 11, 31, 23, 59, 59);
|
||||
break;
|
||||
}
|
||||
if (retval == null) {
|
||||
|
||||
@@ -18,7 +18,6 @@ $(document).ready(function() {
|
||||
$('#comparisonBreadcrumb').find('li').remove()
|
||||
$('#comparisonBreadcrumb')
|
||||
.append ('<li><a class="bread-back-selector2" href="#"><i class="fa fa-chevron-left fa-fw"></i>Return to Indicator View</a>');
|
||||
|
||||
tsPresenter.historicData(
|
||||
$('#indicatorList').val(),
|
||||
$('#periodicityList').val(),
|
||||
@@ -49,8 +48,8 @@ $(document).ready(function() {
|
||||
showErrorBars: false
|
||||
}
|
||||
};
|
||||
|
||||
$('#indicatorsView').hide();
|
||||
$('#scrollImg').hide();
|
||||
$('#compareDiv').show();
|
||||
var graph1 = new LineChart(data, graphParams1, null, null);
|
||||
graph1.drawChart();
|
||||
@@ -59,6 +58,7 @@ $(document).ready(function() {
|
||||
|
||||
$('body').on('click','.bread-back-selector2', function() {
|
||||
$('#indicatorsView').show();
|
||||
$('#scrollImg').show();
|
||||
$('#compareDiv').hide();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -333,7 +333,7 @@ ViewDashboardPresenter.prototype.statusViewModel = function(indicatorId, data) {
|
||||
};
|
||||
var newObject3 = {
|
||||
datalabel : originalObject.taskTitle,
|
||||
value : originalObject.percentageTotalOnTime
|
||||
value : 100 - (originalObject.percentageTotalOverdue + originalObject.percentageTotalAtRisk)
|
||||
};
|
||||
|
||||
if (newObject1.value > 0) {
|
||||
|
||||
@@ -350,16 +350,6 @@ $(document).ready(function() {
|
||||
model.setPositionIndicator(dashboard);
|
||||
});
|
||||
|
||||
|
||||
/*-------------------------------clicks----------------------------*/
|
||||
/*$('body').on('click','.btn-compare', function() {
|
||||
presenter.getDashboardIndicators(window.currentDashboardId, defaultInitDate(), defaultEndDate())
|
||||
.done(function(indicatorsVM) {
|
||||
fillIndicatorWidgets(indicatorsVM);
|
||||
loadIndicator(getFavoriteIndicator().id, defaultInitDate(), defaultEndDate());
|
||||
});
|
||||
});*/
|
||||
|
||||
$('#dashboardsList').on('click','.das-title-selector', function() {
|
||||
var dashboardId = $(this).parent().data('dashboard-id');
|
||||
window.currentDashboardId = dashboardId;
|
||||
@@ -491,6 +481,9 @@ var initialDraw = function () {
|
||||
}
|
||||
|
||||
var loadIndicator = function (indicatorId, initDate, endDate) {
|
||||
$('#indicatorsView').show();
|
||||
$('#scrollImg').show();
|
||||
$('#compareDiv').hide();
|
||||
if (indicatorId == null || indicatorId === undefined) {return;}
|
||||
var builder = new WidgetBuilder();
|
||||
window.currentIndicator = builder.getIndicatorLoadedById(indicatorId);
|
||||
@@ -569,6 +562,7 @@ var fillDashboardsList = function (presenterData) {
|
||||
window.loadedDashboards = presenterData;
|
||||
for (key in presenterData) {
|
||||
var dashboard = presenterData[key];
|
||||
dashboard.title = dashboard.title.replace(''', "'");
|
||||
$('#dashboardsList').append(template(dashboard));
|
||||
if (dashboard.isFavorite == 1) {
|
||||
window.currentDashboardId = dashboard.id;
|
||||
|
||||
Reference in New Issue
Block a user