65 lines
1.4 KiB
HTML
65 lines
1.4 KiB
HTML
<!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;
|
|
}
|
|
.gantt-container {
|
|
overflow: scroll;
|
|
}
|
|
</style>
|
|
<script src="node_modules/moment/min/moment.min.js"></script>
|
|
<script src="node_modules/snapsvg/dist/snap.svg-min.js"></script>
|
|
<script src="lib/gantt.js"></script>
|
|
</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: "Task"+i,
|
|
progress: i*10
|
|
}
|
|
});
|
|
tasks[1].dependencies = 'Task1';
|
|
tasks[2].dependencies = 'Task2';
|
|
|
|
var gantt_chart = gantt("#gantt", tasks, {
|
|
date_format: "YYYY-MM-DD",
|
|
bar: {
|
|
height: 20
|
|
},
|
|
on_click: function (task) {
|
|
console.log(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);
|
|
}
|
|
});
|
|
console.log(gantt_chart);
|
|
</script>
|
|
</body>
|
|
</html> |