From 28f9a7c15dfd8665d46475fb3d209143b2c37e5a Mon Sep 17 00:00:00 2001 From: yitacls <75364857+yitacls@users.noreply.github.com> Date: Tue, 10 Jun 2025 23:00:32 +0800 Subject: [PATCH] =?UTF-8?q?chore=EF=BC=9A=E7=BB=9F=E4=B8=80=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E6=B3=A8=E9=87=8A=E4=B8=BA=E4=B8=AD=E6=96=87=E7=B9=81?= =?UTF-8?q?=E4=BD=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/public/script.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/public/script.js b/src/public/script.js index f0e2da9..cee20ce 100644 --- a/src/public/script.js +++ b/src/public/script.js @@ -1001,7 +1001,7 @@ function renderDependencyGraph() { .force("charge", d3.forceManyBody().strength(-300)) .force("center", d3.forceCenter(width / 2, height / 2)) .force("collide", d3.forceCollide().radius(30)) - // 新增:水平分布力 + // 新增:水平分布力,用於優化節點在水平方向的分布,根據節點的入度和出度來決定節點的水平位置,入度為0的節點(起始節點)靠左,出度為0的節點(終止節點)靠右,其他節點則分布在中間位置 .force("x", d3.forceX().x(d => { // 計算節點的入度和出度 const inDegree = links.filter(l => (l.target.id || l.target) === d.id).length; @@ -1034,7 +1034,7 @@ function renderDependencyGraph() { g.append("g").attr("class", "links"); g.append("g").attr("class", "nodes"); } else { - // --- 更新渲染 --- + // --- 更新圖表渲染 --- console.log("Updating dependency graph"); svg.attr("viewBox", [0, 0, width, height]); simulation.force("center", d3.forceCenter(width / 2, height / 2));