summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Levy <alon@pobox.com>2014-09-28 21:24:50 +0300
committerAlon Levy <alon@pobox.com>2014-09-28 21:24:50 +0300
commit793ca4d46f78243a57bc17ab0575877093a851bf (patch)
tree51cfa2eb5b7a780bb63aec887b4d678b5ad50407
parent83f65c292128f722418274d73b936019dbc0249b (diff)
rhizicore/update: use object for slight readability win/lose (line win)
-rw-r--r--scripts/rhizicore.js14
1 files changed, 6 insertions, 8 deletions
diff --git a/scripts/rhizicore.js b/scripts/rhizicore.js
index c64621d2..2a734bc5 100644
--- a/scripts/rhizicore.js
+++ b/scripts/rhizicore.js
@@ -488,8 +488,12 @@ function myGraph(el) {
nodes = force.nodes();
links = force.links();
- var update = function() {
+ var state_to_link_class = {
+ enter:'enterlink graph',
+ exit:'exitlink graph',
+ };
+ var update = function() {
vis.selectAll(".graph").remove();
link = vis.selectAll(".link")
@@ -521,13 +525,7 @@ function myGraph(el) {
link.enter().append("path")
.attr("d", "M0,-5L10,0L0,5")
.attr("class", function(d) {
-
- if (d.state === "enter") {
- return "enterlink graph";
- } else if (d.state === "exit") {
- return "exitlink graph";
- } else return "link graph";
-
+ return state_to_link_class[d.state] || 'link graph';
})
.style("stroke-dasharray", function(d,i){
if(d.name && d.name.replace(/ /g,"")=="and" && d.state==="temp")