mirror of
https://github.com/fazo96/pbs.git
synced 2025-01-29 14:54:18 +01:00
added experimental gantt diagram
This commit is contained in:
parent
d423a9db72
commit
04a06ac672
@ -17,6 +17,7 @@
|
|||||||
],
|
],
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"vis": "~3.11.0",
|
"vis": "~3.11.0",
|
||||||
"jquery": "~2.1.3"
|
"jquery": "~2.1.3",
|
||||||
|
"moment": "~2.9.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,9 @@
|
|||||||
<body>
|
<body>
|
||||||
<script src="bower_components/jquery/dist/jquery.js"></script>
|
<script src="bower_components/jquery/dist/jquery.js"></script>
|
||||||
<script src="bower_components/vis/dist/vis.min.js"></script>
|
<script src="bower_components/vis/dist/vis.min.js"></script>
|
||||||
|
<script src="bower_components/moment/moment.js"></script>
|
||||||
<div id="pert"></div>
|
<div id="pert"></div>
|
||||||
|
<!--<div id="timeline"></div>-->
|
||||||
<script src="pert-ui.js"></script>
|
<script src="pert-ui.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -1,8 +1,18 @@
|
|||||||
$.get 'data', (d) ->
|
$.get 'data', (d) ->
|
||||||
# Serve the server data
|
# Serve the server data
|
||||||
list = d
|
buildTimeline d
|
||||||
console.log list
|
buildGraph d
|
||||||
buildGraph list
|
|
||||||
|
toDates = (list, startDay) ->
|
||||||
|
list.map (i) ->
|
||||||
|
r = content: ""+i.id, id: i.id
|
||||||
|
if i.startDay? then r.start = moment(startDay).add(i.startDay, 'days').format 'YYYY-MM-DD'
|
||||||
|
if i.endDay? then r.end = moment(startDay).add(i.endDay, 'days').format 'YYYY-MM-DD'
|
||||||
|
return r
|
||||||
|
|
||||||
|
buildTimeline = (data) ->
|
||||||
|
console.log toDates data.activities
|
||||||
|
timeline = new vis.Timeline (document.getElementById 'timeline'), (toDates data.activities), {}
|
||||||
|
|
||||||
buildGraph = (data) ->
|
buildGraph = (data) ->
|
||||||
nodes = data.days.map (x) -> {id: x, label: ""+x}
|
nodes = data.days.map (x) -> {id: x, label: ""+x}
|
||||||
|
Loading…
Reference in New Issue
Block a user