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