Browse Source

Fix date range

pull/1/head
Wahyu Ramadhan 1 year ago
parent
commit
3dbf992702
  1. 34
      view-mode/function/overlaySCurve.js

34
view-mode/function/overlaySCurve.js

@ -121,27 +121,27 @@ function getProgressLine(){
function getScalePaddings(values){
var scale = gantt.getScale();
var dataRange = gantt.getSubtaskDates();
// let minDate = new Date();
// let maxDate = new Date();
let minDate = new Date();
let maxDate = new Date();
let minValueDate = new Date(values.dates[0]);
let maxValueDate = new Date(values.dates[values.dates.length -1]);
// gantt.eachTask(function(task){
// let plannedEarlier = task.planned_start < task.start_date;
// let plannedLater = task.planned_end > task.end_date;
gantt.eachTask(function(task){
let plannedEarlier = task.planned_start < task.start_date;
let plannedLater = task.planned_end > task.end_date;
// if (plannedEarlier) {
// minDate = new Date(Math.min(minDate.getTime(), task.planned_start.getTime()));
// } else {
// minDate = new Date(Math.min(minDate.getTime(), task.start_date.getTime()));
// }
if (plannedEarlier) {
minDate = new Date(Math.min(minDate.getTime(), task.planned_start.getTime()));
} else {
minDate = new Date(Math.min(minDate.getTime(), task.start_date.getTime()));
}
// if (plannedLater) {
// maxDate = new Date(Math.max(maxDate.getTime(), task.planned_end.getTime()));
// } else {
// maxDate = new Date(Math.max(maxDate.getTime(), task.end_date.getTime()));
// }
// })
if (plannedLater) {
maxDate = new Date(Math.max(maxDate.getTime(), task.planned_end.getTime()));
} else {
maxDate = new Date(Math.max(maxDate.getTime(), task.end_date.getTime()));
}
})
var padding = {
left:0,
@ -149,7 +149,7 @@ function getScalePaddings(values){
};
if(dataRange.start_date){
// var yScaleLabelsWidth = 48;
var yScaleLabelsWidth = 48;
// fine tune values in order to align chart with the scale range
padding.left = gantt.posFromDate(minValueDate);
padding.right = scale.full_width - gantt.posFromDate(maxValueDate);

Loading…
Cancel
Save