Browse Source

Adjusting s curve

pull/1/head
Wahyu Ramadhan 1 year ago
parent
commit
accb333552
  1. 29
      view-mode/function/overlaySCurve.js
  2. 30
      view-mode/function/restActivityLink.js

29
view-mode/function/overlaySCurve.js

@ -1,6 +1,7 @@
var overlayControl = gantt.ext.overlay;
var today = new Date();
var return_first;
var parts = [];
var sCurvePayload = {
period: 'week',
@ -26,7 +27,7 @@ function getSCurveData(){
const path = parentUrl.replace("https://adw.ospro.id/#/dashboard-project/", "");
// Split the remaining path by "/"
const parts = path.split("/");
parts = path.split("/");
if (parts[2] && parts[2] == "1") {
$.ajax({
headers: {
@ -92,7 +93,8 @@ function getProgressLine(){
getSCurveData();
var cumulativePlannedDurations = return_first.data[0].data.percentagePlan;
var cumulativeRealDurations = return_first.data[0].data.percentageReal;
return {planned: cumulativePlannedDurations, real: cumulativeRealDurations};
var dates = return_first.data[0].data.dates;
return {planned: cumulativePlannedDurations, real: cumulativeRealDurations, dates: dates};
}
function getScalePaddings(){
@ -119,16 +121,21 @@ function getScalePaddings(){
var myChart;
var lineOverlay = overlayControl.addOverlay(function(container) {
var values = getProgressLine();
var scaleLabels = [];
var scaleLabels = [];
var chartScale = getChartScaleRange();
chartScale.forEach(function(date){
scaleLabels.push(dateToStr(date));
});
if(parts[2] && parts[2] == '1'){
values.dates.forEach(function(date){
var dateScale = new Date(date);
scaleLabels.push(dateToStr(dateScale));
})
} else {
var chartScale = getChartScaleRange();
var values = getProgressLine();
chartScale.forEach(function(date){
scaleLabels.push(dateToStr(date));
});
}
var canvas = document.createElement("canvas");
container.appendChild(canvas);
@ -220,7 +227,7 @@ var lineOverlay = overlayControl.addOverlay(function(container) {
ticks: {
display: true,
min: 0,
stepSize: 100,
stepSize: 10,
}
},
]

30
view-mode/function/restActivityLink.js

@ -1,3 +1,16 @@
var parts = [];
window.parent.postMessage({ action: 'getUrl' }, '*');
window.addEventListener('message', function(event) {
if (event.data && event.data.action === 'sendUrl') {
const parentUrl = event.data.url;
// Remove the base URL and hash
const path = parentUrl.replace("https://adw.ospro.id/#/dashboard-project/", "");
// Split the remaining path by "/"
parts = path.split("/");
}
});
gantt.ajax.get({
url: `${base_url}activity/${ganttId}/${proyekId}/get`,
headers: {
@ -23,9 +36,12 @@ gantt.ajax.get({
isBaselineSet = false;
}
}
gantt.silent(function () {
gantt.parse(data);
});
if(!parts[2]){
gantt.silent(function () {
gantt.parse(data);
});
}
});
function refresData(id){
@ -43,9 +59,11 @@ function refresData(id){
data['data'] = obj.data.data;
data['links'] = obj.data.links;
// console.log("data parse wrong", data);
gantt.silent(function () {
gantt.parse(data);
});
if(!parts[2]){
gantt.silent(function () {
gantt.parse(data);
});
}
if(id){
if(gantt.isTaskExists(id)){
expandTask();

Loading…
Cancel
Save