mirror of
https://github.com/fazo96/pbs.git
synced 2025-01-27 14:34:19 +01:00
added experimental gantt diagram
This commit is contained in:
parent
d423a9db72
commit
04a06ac672
@ -17,6 +17,7 @@
|
||||
],
|
||||
"dependencies": {
|
||||
"vis": "~3.11.0",
|
||||
"jquery": "~2.1.3"
|
||||
"jquery": "~2.1.3",
|
||||
"moment": "~2.9.0"
|
||||
}
|
||||
}
|
||||
|
@ -15,7 +15,9 @@
|
||||
<body>
|
||||
<script src="bower_components/jquery/dist/jquery.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="timeline"></div>-->
|
||||
<script src="pert-ui.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -1,8 +1,18 @@
|
||||
$.get 'data', (d) ->
|
||||
# Serve the server data
|
||||
list = d
|
||||
console.log list
|
||||
buildGraph list
|
||||
buildTimeline d
|
||||
buildGraph d
|
||||
|
||||
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) ->
|
||||
nodes = data.days.map (x) -> {id: x, label: ""+x}
|
||||
|
Loading…
Reference in New Issue
Block a user