首先感謝您快速的答案,我都試過,你說什麼,它的工作,但不正是我想要的:
我想什麼是兩個工作(任務1,任務2)在兩條不同的線上,而不是在一條線上。 這裏是代碼:
var tab1 = [];
tab1[0] = "Task 1";
tab1[1] = "Task 2";
var tab2 = [];
tab2[0] = new Date("2017-04-04T00:00:00");
tab2[1] = new Date("2017-04-04T12:52:00");
var tab3 = [];
tab3[0] = new Date("2017-04-04T15:00:00");
tab3[1] = new Date("2017-04-06T06:00:00");
$(function() {
"use strict";
$(".gantt").gantt({
source: [{
name: "Sprint 0",
desc: "Analysis",
values: [{
from: "/Date("+c.getTime()+")/",
to: "/Date("+d.getTime()+")/",
label: "Requirement Gathering",
customClass: "ganttRed"
},{
from: "/Date("+a.getTime()+")/",
to: "/Date("+e.getTime()+")/",
label: "Scoping",
customClass: "ganttRed"
}]
},{
desc : "Tasks",
values: tab1.map(function(tab, index) {
return {
from: "/Date("+tab2[index].getTime()+")/",
to: "/Date("+tab3[index].getTime()+")/",
label: tab1,
customClass: "ganttRed"
}
})
}],
navigate: "scroll",
scale: "weeks",
maxScale: "months",
minScale: "hours",
itemsPerPage: 30,
useCookie: true,
onItemClick: function(data) {
alert("Item clicked - show some details");
},
onAddClick: function(dt, rowId) {
alert("Empty space clicked - add an item!");
},
onRender: function() {
if (window.console && typeof console.log === "function") {
console.log("chart rendered");
}
}
});
$(".gantt").popover({
selector: ".bar",
title: "I'm a popover",
content: "And I'm the content of said popover.",
trigger: "hover",
placement: "auto right"
});
prettyPrint();
});
謝謝你的幫助