Skip to content

Commit

Permalink
feat(Vis View): ✨ Force Directed Graph: Customisable node colour
Browse files Browse the repository at this point in the history
  • Loading branch information
SkepticMystic committed Aug 15, 2021
1 parent f366bb0 commit e83d9ee
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions src/Visualisations/ForceDirectedG.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,23 @@ export const forceDirectedG = (
.append("input")
.attr("height", 100)
.attr("width", 100)
.attr("type", "color");
.attr("type", "color")
// Doesn't seem to work...
.attr("value", nodeColour);

colourChange.on("change", function changeColor(el) {
const colour = el.target.value
const colour = el.target.value;
node
.transition()
.duration(500)
.style("fill", colour)
.attr("stroke", colour);
.duration(300)
.style("fill", (d) => {
if (d.index === currNodeIndex) return;
return colour;
})
.attr("stroke", (d) => {
if (d.index === currNodeIndex) return;
return colour;
});
});

const data = graphlibToD3(graph);
Expand Down

0 comments on commit e83d9ee

Please sign in to comment.