From 8be04d62c43d9af808a0c86b10af185aec397acd Mon Sep 17 00:00:00 2001 From: niclas Date: Tue, 27 Feb 2024 15:40:34 +0100 Subject: [PATCH] fix [graph] parent node bug --- .../site/docs/01_attachements/javascripts/graph.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tools/mkdocs/site/docs/01_attachements/javascripts/graph.js b/tools/mkdocs/site/docs/01_attachements/javascripts/graph.js index 2465598..ced8070 100644 --- a/tools/mkdocs/site/docs/01_attachements/javascripts/graph.js +++ b/tools/mkdocs/site/docs/01_attachements/javascripts/graph.js @@ -82,6 +82,8 @@ document$.subscribe(function () { path: nodePaths[id] })); + const Parent_Node = nodes[0]; + var links = data.map(d => ({ source: d.source, target: d.target })); var tooltip = d3.select("body").append("div") @@ -121,10 +123,10 @@ document$.subscribe(function () { .data(nodes) .enter().append("circle") .attr("r", function (d, i) { - return i === 0 ? NODE_RADIUS + 5 : NODE_RADIUS; + return d.id === Parent_Node.id ? NODE_RADIUS + 5 : NODE_RADIUS; }) .attr("fill", function (d, i) { - return i === 0 ? Parent_Node_COLOR : NODE_COLOR; + return d.id === Parent_Node.id ? Parent_Node_COLOR : NODE_COLOR; }); // Apply tooltip on nodes @@ -203,10 +205,10 @@ document$.subscribe(function () { .join( enter => enter.append("circle") .attr("r", function (d, i) { - return i === 0 ? NODE_RADIUS + 5 : NODE_RADIUS; + return d.id === Parent_Node.id ? NODE_RADIUS + 5 : NODE_RADIUS; }) .attr("fill", function (d, i) { - return i === 0 ? Parent_Node_COLOR : NODE_COLOR; + return d.id === Parent_Node.id ? Parent_Node_COLOR : NODE_COLOR; }), update => update, exit => exit.remove()