diff options
| author | Owen <despito@MacBook-Pro-de-Despito.local> | 2014-07-24 19:39:58 +0300 |
|---|---|---|
| committer | Owen <despito@MacBook-Pro-de-Despito.local> | 2014-07-24 19:40:07 +0300 |
| commit | e447868c12a9d72e02817a4d699c4f6810420e3e (patch) | |
| tree | 2178f1bce860e2e3d668d364fc09bdbdc7daa708 | |
| parent | a58169386ca1feb178e73ba881b5223d6f6e0087 (diff) | |
Status icons + Gantt/Graph transition
Transition is now fixed and now has a neat movement effect
Each icon now has a status value (done, current, not done) to indicate
the state of deliverables
Gantt button was moved for better UI
| -rw-r--r-- | images/check.png | bin | 0 -> 321 bytes | |||
| -rw-r--r-- | images/checks.psd | bin | 0 -> 24278 bytes | |||
| -rw-r--r-- | images/cross.png | bin | 0 -> 427 bytes | |||
| -rw-r--r-- | images/delivcheck.png | bin | 0 -> 360 bytes | |||
| -rw-r--r-- | images/delivcross.png | bin | 0 -> 516 bytes | |||
| -rw-r--r-- | images/delivwait.png | bin | 0 -> 559 bytes | |||
| -rw-r--r-- | images/wait.png | bin | 0 -> 583 bytes | |||
| -rw-r--r-- | scripts/buttons.js | 4 | ||||
| -rw-r--r-- | scripts/gant.js | 19 | ||||
| -rw-r--r-- | scripts/rhizicore.js | 85 | ||||
| -rw-r--r-- | scripts/watchdog.js | 10 | ||||
| -rw-r--r-- | style.css | 22 |
12 files changed, 92 insertions, 48 deletions
diff --git a/images/check.png b/images/check.png Binary files differnew file mode 100644 index 00000000..c663c0bb --- /dev/null +++ b/images/check.png diff --git a/images/checks.psd b/images/checks.psd Binary files differnew file mode 100644 index 00000000..60159350 --- /dev/null +++ b/images/checks.psd diff --git a/images/cross.png b/images/cross.png Binary files differnew file mode 100644 index 00000000..a93bec84 --- /dev/null +++ b/images/cross.png diff --git a/images/delivcheck.png b/images/delivcheck.png Binary files differnew file mode 100644 index 00000000..b5837e6c --- /dev/null +++ b/images/delivcheck.png diff --git a/images/delivcross.png b/images/delivcross.png Binary files differnew file mode 100644 index 00000000..605497d1 --- /dev/null +++ b/images/delivcross.png diff --git a/images/delivwait.png b/images/delivwait.png Binary files differnew file mode 100644 index 00000000..1a334d7c --- /dev/null +++ b/images/delivwait.png diff --git a/images/wait.png b/images/wait.png Binary files differnew file mode 100644 index 00000000..0c18155b --- /dev/null +++ b/images/wait.png diff --git a/scripts/buttons.js b/scripts/buttons.js index 980a51d9..b29e85e9 100644 --- a/scripts/buttons.js +++ b/scripts/buttons.js @@ -29,7 +29,7 @@ $('.save').click(function(){ console.log(nodes); for(var i=0;i<nodes.length;i++){ var node=nodes[i]; - jsonsave+='{"id":"'+node.id+'","type":"'+node.type+'","state":"'+"perm"+'","start":"'+node.start+'","end":"'+node.end+'"}'; + jsonsave+='{"id":"'+node.id+'","type":"'+node.type+'","state":"'+"perm"+'","start":"'+node.start+'","end":"'+node.end+'","status":"'+node.status+'"}'; if(i!==nodes.length-1)jsonsave+=','; } jsonsave+='],"links":['; @@ -58,7 +58,7 @@ $('.load').click(function(){ console.log(data); for(var i=0; i<data["nodes"].length; i++){ var node=data.nodes[i]; - graph.addNodeComplete(node.id,node.type,"perm",new Date(node.start),new Date(node.end)); + graph.addNodeComplete(node.id,node.type,"perm",new Date(node.start),new Date(node.end),node.status); } for(var j=0; j<data["links"].length; j++){ diff --git a/scripts/gant.js b/scripts/gant.js index 6747a244..69d88961 100644 --- a/scripts/gant.js +++ b/scripts/gant.js @@ -7,24 +7,29 @@ function checkSwitch(checkswitch) { vis.selectAll(".gantt").remove(); $('.missingdates').fadeOut(300); scrollValue = $('body').scrollLeft(); - console.log(scrollValue); $('body').scrollLeft(0); graphstate = "GRAPH"; - var fake_e = {}; - fake_e.alpha = 0.1; - tick(fake_e); + graph.updateGraph(); + + $('.status').fadeOut(600); //boxedin=false; } else { + ganttTimer=0; $('.missingdates').fadeIn(300); + + graph.recenterZoom(); + $('body').scrollLeft(scrollValue); graphstate = "GANTT"; - var fake_e = {}; - fake_e.alpha = 0.1; - tick(fake_e); + + graph.updateGraph(); + + + $('.status').fadeIn(600); initAxis(); diff --git a/scripts/rhizicore.js b/scripts/rhizicore.js index dbf74c24..7b0e7514 100644 --- a/scripts/rhizicore.js +++ b/scripts/rhizicore.js @@ -6,6 +6,8 @@ var vis; var graphstate = "GRAPH"; var graphinterval = 0; +var ganttTimer=0; + var boxedin = false; var deliverables = []; @@ -15,12 +17,14 @@ var boxedin, nodetext, linktext, link, links, node, nodes, circle; var scrollValue = 0, zoomLevel=0, zoomObject; + function myGraph(el) { ///FUNCTIONS this.addNode = function (id, type, state) { var start = 0, end = 0; + var status= "unknown"; var node = findNode(id, null); if (node !== undefined) { graph.editState(id, null, "temp"); @@ -30,14 +34,15 @@ function myGraph(el) { "type": type, "state": state, "start": start, - "end": end + "end": end, + "status": status }); } update(); } - this.addNodeComplete = function (id, type, state, start, end) { + this.addNodeComplete = function (id, type, state, start, end, status) { var node = findNode(id, null); if (node !== undefined) { graph.editState(id, null, "temp"); @@ -47,7 +52,8 @@ function myGraph(el) { "type": type, "state": state, "start": start, - "end": end + "end": end, + "status": status }); } @@ -197,6 +203,14 @@ function myGraph(el) { } } + this.updateGraph = function(){ + update(); + } + + this.recenterZoom = function(){ + vis.attr("transform", "translate(0,0)scale(1)"); + } + var findLink = function (sourceId, targetId, name) { @@ -232,7 +246,7 @@ function myGraph(el) { var color = d3.scale.category20(); //Zoom scale behavior in zoom.js - zoomObject=d3.behavior.zoom().scaleExtent([0.5, 10]).on("zoom", zoom); + zoomObject=d3.behavior.zoom().scaleExtent([0.5, 3]).on("zoom", zoom); vis = this.vis = d3.select(el).append("svg:svg") .attr("width", w*5) @@ -286,15 +300,15 @@ function myGraph(el) { - var update = function () { vis.selectAll(".graph").remove(); + link = vis.selectAll(".link") .data(links); vis.append("rect") - .attr("class", "overlay") + .attr("class", "overlay graph") .attr("width", w*5) .attr("height", h); $('.overlay').click(mousedown); @@ -304,10 +318,10 @@ function myGraph(el) { .enter().append("svg:marker") // This section adds in the arrows .attr("id", String) .attr("viewBox", "0 -5 10 10") - .attr("refX", 23) - .attr("refY", -1.8) - .attr("markerWidth", 5) - .attr("markerHeight", 5) + .attr("refX", 22) + .attr("refY", -1.5) + .attr("markerWidth", 4) + .attr("markerHeight", 4) .attr("orient", "auto") .attr("class","graph") .style("fill", "#aaa") @@ -363,8 +377,8 @@ function myGraph(el) { nodetext = nodeEnter.insert("text") .attr("class", "nodetext graph") - .attr("dx", 20) - .attr("dy", ".35em") + .attr("dx", 15) + .attr("dy", ".30em") .text(function (d) { if (d.state === "temp") return d.id + "|"; else if(d.state === "chosen"){ @@ -379,11 +393,13 @@ function myGraph(el) { showInfo(d, i); }); + + circle = nodeEnter.insert("circle") .attr("class", "circle graph") .attr("r", function (d) { - if (d.state === "temp" && d.type !== "empty") return '16px'; - else return customSize(d.type); + if (d.state === "temp" && d.type !== "empty") return '13px'; + else return customSize(d.type)-2; }) .style("fill", function (d) { return customColor(d.type); @@ -410,6 +426,25 @@ function myGraph(el) { showInfo(d, i); }); + //if(graphstate==="GANTT"){ + nodeEnter.append("svg:image") + .attr("class", "status graph") + .attr('x',-7) + .attr('y',-8) + .attr('width', 15) + .attr('height', 15) + .attr("xlink:href",function (d) { + switch(d.status){ + case "done": return "images/delivcheck.png"; break; + case "current": return "images/delivwait.png"; break; + case "waiting": return "images/delivcross.png"; break; + } + }) + .on("click", function (d, i) { + showInfo(d, i); + }); + //} + node.exit().remove(); //d3.select("body").on("mousedown", mousedown); @@ -505,8 +540,14 @@ function tick(e) { //var min= 150+graphinterval*Math.ceil(Math.abs(d.start.getTime() - today.getTime()) / (1000 * 3600 * 24)) - $('.gantbox').scrollLeft(); //var max= 150+graphinterval*Math.ceil(Math.abs(d.end.getTime() - d.start.getTime()) / (1000 * 3600 * 24)) - $('.gantbox').scrollLeft(); //d.x = min+Math.sin(today.getTime()/1000*Math.PI*2/10)*max; - d.x = 150 + graphinterval * Math.ceil(Math.abs(d.start.getTime() - today.getTime()) / (1000 * 3600 * 24)); - d.y = 150 + d.start.getHours() * 17; + ganttTimer++; + if(ganttTimer<3000){ + d.x = 150 + graphinterval * Math.ceil(Math.abs(d.start.getTime() - today.getTime()) / (1000 * 3600 * 24))*ganttTimer/3000; + d.y = 150 + d.start.getHours() * 17; + }else{ + d.x = 150 + graphinterval * Math.ceil(Math.abs(d.start.getTime() - today.getTime()) / (1000 * 3600 * 24)); + d.y = 150 + d.start.getHours() * 17; + } } if(d.state==="chosen"){ scrollValue=d.x; @@ -584,10 +625,14 @@ function tick(e) { function deliverableTest() { + var status= "unknown"; for (var i = 0; i < 60; i++) { + if(Math.random()>0.7)status="done"; + else if(Math.random()>0.5) status="current"; + else status="waiting"; var end = randomDate(new Date(), new Date("01-01-2018")); var start = randomDate(new Date(), end); - graph.addNodeComplete("Task " + i, "deliverable", "perm", start, end); + graph.addNodeComplete("Task " + i, "deliverable", "perm", start, end, status); } for (var i = 0; i < 60; i++) { @@ -614,7 +659,7 @@ function showInfo(d, i) { $('.info').fadeIn(300); if (d.type === "deliverable") { - $('.info').html('Name: '+d.id+'<br/><form id="editbox"><label>description:</label><input id="editdescription"/><label>URL:</label><input id="editurl"/><label>Start date:</label><input id="editstartdate"/><label>End date:</label><input id="editenddate"/><button>Save</button></form><div id="deletenode"><button>Delete</button></div>'); + $('.info').html('Name: '+d.id+'<br/><form id="editbox"><label>description:</label><input id="editdescription"/><label>Status</label><input id="editstatus"/><label>Start date:</label><input id="editstartdate"/><label>End date:</label><input id="editenddate"/><button>Save</button></form><div id="deletenode"><button>Delete</button></div>'); } else { $('.info').html('Name: '+d.id+'<br/><form id="editbox"><label>description:</label><input id="editdescription"/><label>URL:</label><input id="editurl"/><button>Save</button></form><div id="deletenode"><button>Delete</button></div>'); } @@ -635,7 +680,7 @@ function showInfo(d, i) { $('#editdescription').val(d.type); - $('#editurl').val('www.' + d.id + '.com'); + $('#editstatus').val(d.status ); if (d.type === "deliverable") { $('#editstartdate').val(d.start); @@ -734,7 +779,7 @@ function customColor(type) { color = '#62BB47'; break; case "deliverable": - color = '#E03A3E'; + color = '#CCC'; break; case "objective": color = '#933E99'; diff --git a/scripts/watchdog.js b/scripts/watchdog.js index 9ecdb6da..b28b04f6 100644 --- a/scripts/watchdog.js +++ b/scripts/watchdog.js @@ -1,13 +1,3 @@ -var oldtext; -$('#textanalyser').keyup(function(){ - - var counter=$('#textanalyser').val().match(/([#])/g); - if(counter.length>2){ - $('#textanalyser').val(oldtext); - } - oldtext=$('#textanalyser').val(); - -}); @@ -212,6 +212,10 @@ input:focus { text-align: center; } +.status{ + display:none; +} + /* .typeselection{ position:fixed; @@ -398,9 +402,9 @@ input:focus { .onoffswitch { z-index:100; position: fixed; - width: 114px; - top:90px; - right: 30px; + width: 140px; + top:35px; + right: 180px; -webkit-user-select:none; -moz-user-select:none; -ms-user-select: none; } @@ -421,19 +425,19 @@ input:focus { .onoffswitch-inner:before, .onoffswitch-inner:after { display: block; float: left; width: 50%; height: 20px; padding: 0; line-height: 20px; - font-size: 15px; color: white; font-weight: bold; + font-size: 14px; color: white; font-weight: bold; -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box; } .onoffswitch-inner:before { - content: "GRAPH"; - padding-left: 10px; + content: "GANTT VIEW"; + padding-left: 5px; background-color: #080808; color: #FFFFFF; } .onoffswitch-inner:after { - content: "GANTT"; - padding-right: 10px; + content: "GRAPH VIEW"; + padding-right: 5px; background-color: #080808; color: #FFFFFF; text-align: right; } @@ -442,7 +446,7 @@ input:focus { display: block; width: 35px; margin: 0px; background: #3D3D3D; border: 1px solid #FFFFFF; border-radius: 5px; - position: absolute; top: 0; bottom: 0; right: 75px; + position: absolute; top: 0; bottom: 0; right: 105px; -moz-transition: all 0.3s ease-in 0s; -webkit-transition: all 0.3s ease-in 0s; -o-transition: all 0.3s ease-in 0s; transition: all 0.3s ease-in 0s; background-image: -moz-linear-gradient(center top, rgba(0,0,0,0.1) 0%, rgba(0,0,0,0) 100%); |
