From a3df92c39304c8ba4d6e2530266deb392cf5bfa9 Mon Sep 17 00:00:00 2001 From: shishilong Date: Fri, 8 May 2026 20:41:47 +0800 Subject: [PATCH] fix: use #graph-svg ID selector instead of generic svg selector The legend section uses inline elements for node type icons which appear before the main in the DOM. d3.select("svg") matched the first inline SVG (16x16 icon) instead of the main canvas, causing the graph to render inside the tiny legend icon. Replace d3.select("svg") with d3.select("#graph-svg") at both occurrences (lines 859 and 1759) to target the correct element. Closes #450 --- code_review_graph/visualization.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code_review_graph/visualization.py b/code_review_graph/visualization.py index c78b5735..db7e5fbd 100644 --- a/code_review_graph/visualization.py +++ b/code_review_graph/visualization.py @@ -856,7 +856,7 @@ def generate_html( } function hideTooltip() { tooltip.classList.remove("visible"); } var W = innerWidth, H = innerHeight; -var svg = d3.select("svg").attr("viewBox", [0, 0, W, H]); +var svg = d3.select("#graph-svg").attr("viewBox", [0, 0, W, H]); var gRoot = svg.append("g"); var currentTransform = d3.zoomIdentity; var zoomBehavior = d3.zoom() @@ -1756,7 +1756,7 @@ def generate_html( /* --- SVG setup --- */ var W = innerWidth, H = innerHeight; -var svg = d3.select("svg").attr("viewBox", [0, 0, W, H]); +var svg = d3.select("#graph-svg").attr("viewBox", [0, 0, W, H]); var gRoot = svg.append("g"); var currentTransform = d3.zoomIdentity; var zoomBehavior = d3.zoom()