Hi!
I have performed some tests based on the samples supplied. My main goal is to determine how the gantt performs when scrolling horizontally/vertically when lots of tasks are displayed.
First example is based on 01-basic_init.html which I have modified to load 100 tasks spread over days.
<!DOCTYPE html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>Basic initialization</title>
</head>
<script src="../../sources/codebase/dhtmlxgantt.js" type="text/javascript" charset="utf-8"></script>
<link rel="stylesheet" href="../../sources/codebase/dhtmlxgantt.css" type="text/css" media="screen" title="no title" charset="utf-8">
<script type="text/javascript" src="../../common/testdata.js"></script>
<style type="text/css">
html, body{ height:100%; padding:0px; margin:0px; overflow: hidden;}
</style>
<body>
<div id="gantt_here" style='width:100%; height:100%;'></div>
<script type="text/javascript">
/* var tasks = {
data:[
{id:1, text:"Project #2", start_date:"01-04-2013", duration:18,order:10,
progress:0.4, open: true},
{id:2, text:"Task #1", start_date:"02-04-2013", duration:8, order:10,
progress:0.6, parent:1},
{id:3, text:"Task #2", start_date:"11-04-2013", duration:8, order:20,
progress:0.6, parent:1}
],
links:[
{ id:1, source:1, target:2, type:"1"},
{ id:2, source:2, target:3, type:"0"},
{ id:3, source:3, target:4, type:"0"},
{ id:4, source:2, target:5, type:"2"},
]
};*/
function GetFormattedDate(d) {
var todayTime = d;
var month = todayTime.getMonth() + 1;
var day = todayTime.getDate();
var year = todayTime.getFullYear();
return day + "-" + month + "-" + year;
}
var tasks = {
data: [],
links: []
};
var date = new Date('02-04-2013');
tasks.data.push({
id: 1,
start_date: GetFormattedDate(date),
text: "Project1",
open:true
});
for (var i = 1; i < 100; i++) {
date.setDate(date.getDate() + 1);
tasks.data.push({
id: i + 1,
start_date: GetFormattedDate(date),
text: "Task " + (i + 1),
duration: 8,
parent:1
});
}
gantt.init("gantt_here");
gantt.parse(tasks);
</script>
This performs pretty well. Even expanding the node Project 1 was pretty quick.
Based on this I have tried to increase tasks to 1000 even 10000. With 1000 it eventually loaded but was quite slow to scroll, for 10000 it took too long and I killed it. Very slow expanding Project 1 too.
Second example;
var tasks = {
data: [],
links: []
};
var date = new Date('02-04-2013');
tasks.data.push({
id: 1,
start_date: GetFormattedDate(date),
text: "Project1",
open:true
});
for (var i = 1; i < 100; i++) {
date.setDate(date.getDate() + 1);
tasks.data.push({
id: i + 1,
start_date: GetFormattedDate(date),
text: "Task " + (i + 1),
duration: 8,
parent:1
});
}
tasks.data.push({
id: 101,
start_date: GetFormattedDate(date),
text: "Project2",
open:true
});
for (var i = 1; i < 100; i++) {
date.setMonth(date.getMonth() + 1);
tasks.data.push({
id: i + 101,
start_date: GetFormattedDate(date),
text: "Task " + (i + 101),
duration: 8,
parent:101
});
}
this time I added Project 2 node with another 100 tasks this time spread over months. Result was pretty bad as browser did not even respond after loading.
In those two examples I have not included any dependencies and I would expect lower performance with more things drawn on screen.
Performance is key for our project, maybe there is a better way to create the tasks and send them to the gantt, please advise.