forked from frappe/gantt
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathindex.html
148 lines (146 loc) · 2.92 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Simple Gantt</title>
<style>
body {
font-family: sans-serif;
background: #ccc;
}
.container {
width: 80%;
margin: 0 auto;
}
/* custom task group classes */
.gantt .bar-design .bar {
fill: darkorchid;
}
.gantt .bar-design .bar-progress {
fill: darkmagenta;
}
.gantt .bar-development .bar {
fill: limegreen;
}
.gantt .bar-development .bar-progress {
fill: lime;
}
.gantt .bar-integration .bar {
fill: crimson;
}
.gantt .bar-integration .bar-progress {
fill: tomato;
}
/* custom class */
.gantt .bar-milestone .bar {
fill: orangered;
}
</style>
<link rel="stylesheet" href="dist/frappe-gantt.css" />
<script src="dist/frappe-gantt.js"></script>
</head>
<body>
<div class="container">
<h2>Interactive Gantt Chart entirely made in SVG!</h2>
<div class="gantt-target"></div>
</div>
<script>
var tasks = [
{
start: '2018-10-01',
end: '2018-10-08',
name: 'Redesign website',
id: "Task 0",
group_id: "design",
progress: 20
},
{
start: '2018-10-03',
end: '2018-10-06',
name: 'Write new content',
id: "Task 1",
group_id: "development",
progress: 5,
dependencies: 'Task 0'
},
{
start: '2018-10-04',
end: '2018-10-08',
name: 'Apply new styles',
id: "Task 2",
group_id: "development",
progress: 10,
dependencies: 'Task 1'
},
{
start: '2018-10-08',
end: '2018-10-09',
name: 'Review',
id: "Task 3",
group_id: "integration",
progress: 5,
dependencies: 'Task 2'
},
{
start: '2018-10-08',
end: '2018-10-10',
name: 'Deploy',
id: "Task 4",
group_id: "integration",
progress: 0,
dependencies: 'Task 2'
},
{
start: '2018-10-11',
end: '2018-10-11',
name: 'Go Live!',
id: "Task 5",
group_id: "integration",
progress: 0,
dependencies: 'Task 4',
custom_class: 'bar-milestone'
}
]
var gantt_chart = new Gantt(".gantt-target", tasks, {
groups: [
{
id: 'design',
name: 'Web Design',
bar_class: 'bar-design'
},
{
id: 'development',
name: 'Development',
bar_class: 'bar-development'
},
{
id: 'integration',
name: 'Integration & Deployment',
bar_class: 'bar-integration'
}
],
on_click: function (task) {
console.log(task);
},
on_dependency_added: function (task) {
console.log("added dependency to: " + task);
},
on_dependency_removed: function (task) {
console.log("removed dependency from: " + task);
},
on_date_change: function(task, start, end) {
console.log(task, start, end);
},
on_progress_change: function(task, progress) {
console.log(task, progress);
},
on_view_change: function(mode) {
console.log(mode);
},
view_mode: 'Month',
language: 'en'
});
console.log(gantt_chart);
</script>
</body>
</html>