forked from frappe/gantt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
67 lines (66 loc) · 1.37 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
<!DOCTYPE html>
<html>
<head>
<title>Frappé Gantt</title>
<link rel="stylesheet" href="dist/frappe-gantt.css">
<script src="node_modules/moment/min/moment.min.js"></script>
<script src="node_modules/snapsvg/dist/snap.svg-min.js"></script>
<script src="dist/frappe-gantt.min.js"></script>
<style>
body {
font-family: sans-serif;
background: #ccc;
}
.container {
width: 80%;
margin: 0 auto;
}
.gantt-container {
overflow: scroll;
}
</style>
</head>
<body>
<div class="container">
<h2>Interactive Gantt Chart entirely made in SVG!</h2>
<div class="gantt-container">
<svg id="gantt" width="400" height="600"></svg>
</div>
</div>
<script>
var arr = [1, 2, 3, 4, 5, 6];
var tasks = arr.map(function(i){
return {
start: "2016-10-0"+i,
end: "2016-10-2"+i,
name: "Task "+i,
id: i,
progress: i*10
}
});
var gantt = new Gantt({
parent_selector: '#gantt',
tasks: tasks,
date_format: "YYYY-MM-DD",
bar: {
height: 20
},
events: {
bar_on_click: function (task) {
console.log(task);
},
bar_on_date_change: function(task, start, end) {
console.log(task, start, end);
},
bar_on_progress_change: function(task, progress) {
console.log(task, progress);
},
on_viewmode_change: function(mode) {
console.log(mode);
}
}
});
gantt.render();
</script>
</body>
</html>