Skip to content

Commit acc4454

Browse files
committed
Tidied code
1 parent b506e30 commit acc4454

File tree

2 files changed

+18
-17
lines changed

2 files changed

+18
-17
lines changed

src/components/ForceGraph.module.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,29 +43,34 @@
4343
stroke: #4a7b9d;
4444
stroke-width: 0.1em;
4545
stroke-opacity: 40%;
46+
fill: none;
4647
}
4748

4849
.link_indirect {
4950
stroke: #54577c;
5051
stroke-width: 0.1em;
5152
stroke-opacity: 50%;
53+
fill: none;
5254
}
5355

5456
.link_weak.highlight {
5557
stroke: red;
5658
stroke-width: 0.1em;
5759
stroke-opacity: 50%;
60+
fill: none;
5861
}
5962

6063
.link_indirect.highlight {
6164
stroke: red;
6265
stroke-width: 0.1em;
6366
stroke-opacity: 50%;
67+
fill: none;
6468
}
6569

6670
.link.highlight {
6771
stroke: red;
6872
stroke-width: 0.2em;
73+
fill: none;
6974
}
7075

7176
.node_text {

src/components/d3/ForceGraph.d3.js

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -713,23 +713,19 @@ class ForceGraphD3 extends React.Component {
713713
.enter()
714714
.append("path")
715715
.attr("class", `link ${styles.link}`)
716-
// .join(
717-
// (enter) => enter.append("line").attr("class", `link ${styles.link}`),
718-
// (update) => update.attr("class", `link ${styles.link}`)
719-
// )
720-
// .attr("class", (d) => {
721-
// // Here we're using the weight of the edges between
722-
// // nodes to change the properties of the line drawn
723-
// if (d.type === "direct") {
724-
// if (d.value > weightCutoff) {
725-
// return `link ${styles.link}`;
726-
// } else {
727-
// return `link ${styles.link_weak}`;
728-
// }
729-
// } else {
730-
// return `link ${styles.link_indirect}`;
731-
// }
732-
// })
716+
.attr("class", (d) => {
717+
// Here we're using the weight of the edges between
718+
// nodes to change the properties of the line drawn
719+
if (d.type === "direct") {
720+
if (d.value > weightCutoff) {
721+
return `link ${styles.link}`;
722+
} else {
723+
return `link ${styles.link_weak}`;
724+
}
725+
} else {
726+
return `link ${styles.link_indirect}`;
727+
}
728+
})
733729
.attr("id", (d) => {
734730
return d.id;
735731
})

0 commit comments

Comments
 (0)