You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Also problematically, in this line of code, functions like getStart default to the current date if no date is found (such as when the task is a group and has no start/end):
When these two behaviours are combined it means that when your first grouped task has a min date of sometime in the future, the gantt chat always begins at today, even if vMinDate is specified.
This can be very troublesome when doing projects where the project begins a few years in the future, as you will have many years of nothing happening.
Sample code:
<link href="jsgantt.css" rel="stylesheet" type="text/css"/>
<script src="jsgantt.js" type="text/javascript"></script>
<div style="position:relative" class="gantt" id="GanttChartDIV"></div>
<script type="text/javascript">
var g = new JSGantt.GanttChart(document.getElementById('GanttChartDIV'), 'week');
g.setOptions({
vCaptionType: 'Complete', // Set to Show Caption : None,Caption,Resource,Duration,Complete,
vQuarterColWidth: 36,
vDateTaskDisplayFormat: 'day dd month yyyy', // Shown in tool tip box
vDayMajorDateDisplayFormat: 'mon yyyy - Week ww',// Set format to dates in the "Major" header of the "Day" view
vWeekMinorDateDisplayFormat: 'dd mon', // Set format to display dates in the "Minor" header of the "Week" view
vLang: 'en',
//vMinDate: new Date('2027-01-01'),
vShowTaskInfoLink: 1, // Show link in tool tip (0/1)
vShowEndWeekDate: 0, // Show/Hide the date for the last day of the week in header for daily
vUseSingleCell: 10000, // Set the threshold cell per table row (Helps performance for large data.
vFormatArr: ['Day', 'Week', 'Month', 'Quarter'], // Even with setUseSingleCell using Hour format on such a large chart can cause issues in some browsers,
vTotalHeight: 900,
});
var json_data = `
[{"pID": 540527, "pName": "foo", "pStart": "", "pEnd": "", "pPlanStart": "", "pPlanEnd": "", "pMile": 0, "pComp": 0, "pGroup": 1, "pParent": 540526, "pOpen": 1, "pCost": 1, "pClass": "ggroupblack", "pDepend": ""}, {"pID": 540529, "pName": "bar", "pStart": "2027-01-01T00:00:00", "pEnd": "2027-01-29T00:00:00", "pPlanStart": "2027-01-01T00:00:00", "pPlanEnd": "2027-01-29T00:00:00", "pMile": 0, "pComp": 0, "pGroup": 0, "pParent": 540527, "pOpen": 1, "pCost": 1, "pClass": "gtaskred", "pDepend": ""}, {"pID": 540535, "pName": "asdf", "pStart": "2027-01-15T00:00:00", "pEnd": "2027-01-29T00:00:00", "pPlanStart": "2027-01-15T00:00:00", "pPlanEnd": "2027-01-29T00:00:00", "pMile": 0, "pComp": 0, "pGroup": 0, "pParent": 540527, "pOpen": 1, "pCost": 1, "pClass": "gtaskred", "pDepend": "540529FS"}, {"pID": 540545, "pName": "asdf", "pStart": "2027-01-29T00:00:00", "pEnd": "2027-02-12T00:00:00", "pPlanStart": "2027-01-29T00:00:00", "pPlanEnd": "2027-02-12T00:00:00", "pMile": 0, "pComp": 0, "pGroup": 0, "pParent": 540527, "pOpen": 1, "pCost": 1, "pClass": "gtaskred", "pDepend": "540535FS"}, {"pID": 540554, "pName": "asdf", "pStart": "2027-02-12T00:00:00", "pEnd": "2027-02-26T00:00:00", "pPlanStart": "2027-02-12T00:00:00", "pPlanEnd": "2027-02-26T00:00:00", "pMile": 0, "pComp": 0, "pGroup": 0, "pParent": 540527, "pOpen": 1, "pCost": 1, "pClass": "gtaskred", "pDepend": "540545FS"}, {"pID": 540563, "pName": "asdf", "pStart": "2027-02-26T00:00:00", "pEnd": "2027-03-12T00:00:00", "pPlanStart": "2027-02-26T00:00:00", "pPlanEnd": "2027-03-12T00:00:00", "pMile": 0, "pComp": 0, "pGroup": 0, "pParent": 540527, "pOpen": 1, "pCost": 1, "pClass": "gtaskred", "pDepend": "540554FS"}, {"pID": 540572, "pName": "asdf", "pStart": "2027-03-12T00:00:00", "pEnd": "2027-03-26T00:00:00", "pPlanStart": "2027-03-12T00:00:00", "pPlanEnd": "2027-03-26T00:00:00", "pMile": 0, "pComp": 0, "pGroup": 0, "pParent": 540527, "pOpen": 1, "pCost": 1, "pClass": "gtaskred", "pDepend": "540563FS"}, {"pID": 540581, "pName": "asdf", "pStart": "2027-03-26T00:00:00", "pEnd": "2027-04-09T00:00:00", "pPlanStart": "2027-03-26T00:00:00", "pPlanEnd": "2027-04-09T00:00:00", "pMile": 0, "pComp": 0, "pGroup": 0, "pParent": 540527, "pOpen": 1, "pCost": 1, "pClass": "gtaskred", "pDepend": "540572FS"}, {"pID": 540590, "pName": "asdf", "pStart": "2027-04-09T00:00:00", "pEnd": "2027-04-23T00:00:00", "pPlanStart": "2027-04-09T00:00:00", "pPlanEnd": "2027-04-23T00:00:00", "pMile": 0, "pComp": 0, "pGroup": 0, "pParent": 540527, "pOpen": 1, "pCost": 1, "pClass": "gtaskred", "pDepend": "540581FS"}, {"pID": 540599, "pName": "asdf", "pStart": "2027-04-23T00:00:00", "pEnd": "2027-05-07T00:00:00", "pPlanStart": "2027-04-23T00:00:00", "pPlanEnd": "2027-05-07T00:00:00", "pMile": 0, "pComp": 0, "pGroup": 0, "pParent": 540527, "pOpen": 1, "pCost": 1, "pClass": "gtaskred", "pDepend": "540590FS"}, {"pID": 540608, "pName": "asdf", "pStart": "2027-05-07T00:00:00", "pEnd": "2027-05-21T00:00:00", "pPlanStart": "2027-05-07T00:00:00", "pPlanEnd": "2027-05-21T00:00:00", "pMile": 0, "pComp": 0, "pGroup": 0, "pParent": 540527, "pOpen": 1, "pCost": 1, "pClass": "gtaskred", "pDepend": "540599FS"}, {"pID": 540617, "pName": "Foo", "pStart": "2027-01-29T00:00:00", "pEnd": "2027-02-08T00:00:00", "pPlanStart": "2027-01-29T00:00:00", "pPlanEnd": "2027-02-08T00:00:00", "pMile": 0, "pComp": 0, "pGroup": 0, "pParent": 540527, "pOpen": 1, "pCost": 1, "pClass": "gtaskblue", "pDepend": "540529FS"}]
`;
JSGantt.parseJSONString(json_data, g);
g.Draw();
</script>
The text was updated successfully, but these errors were encountered:
Because a group task could have start and end date, that basically take the min date and max date from the children tasks.
So the getMinDate method, returns the current date just if you dont have tasks.
When you have tasks it will start to find the min with minDate or the first task list.
In this line of code, vDate defaults to the current date:
jsgantt-improved/src/utils/date_utils.ts
Line 6 in 7d69691
Also problematically, in this line of code, functions like getStart default to the current date if no date is found (such as when the task is a group and has no start/end):
jsgantt-improved/src/utils/date_utils.ts
Lines 13 to 14 in 7d69691
When these two behaviours are combined it means that when your first grouped task has a min date of sometime in the future, the gantt chat always begins at today, even if vMinDate is specified.
This can be very troublesome when doing projects where the project begins a few years in the future, as you will have many years of nothing happening.
Sample code:
The text was updated successfully, but these errors were encountered: