Skip to content

Commit 7f727b4

Browse files
test 2
1 parent 98dbdb9 commit 7f727b4

2 files changed

Lines changed: 23 additions & 174 deletions

File tree

default_index.html

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,18 @@
88
body {
99
font-family: sans-serif;
1010
}
11+
html, body {
12+
margin: 0;
13+
padding: 0;
14+
width: 100%;
15+
height: 100%;
16+
overflow: hidden; /* no scrollbars */
17+
}
18+
svg {
19+
width: 100%;
20+
height: 100%;
21+
display: block; /* remove default spacing */
22+
}
1123
.link {
1224
stroke: #999;
1325
stroke-opacity: 0.6;
@@ -34,9 +46,7 @@ <h1>Code Graph Visualization</h1>
3446
.catch(err => console.error("Fetch error:", err));
3547

3648
function drawGraph(graph) {
37-
const width = 960,
38-
height = 600;
39-
49+
const width = window.innerWidth, height = window.innerHeight;
4050
// Create an SVG
4151
const svg = d3.select("#chart")
4252
.append("svg")
@@ -50,6 +60,16 @@ <h1>Code Graph Visualization</h1>
5060
method: "#2ca02c"
5161
};
5262

63+
const zoomBehavior = d3.zoom()
64+
.scaleExtent([0.1, 10]) // optional limit: from 10% to 1000% zoom
65+
.on("zoom", (event) => {
66+
// 2) The "zoom" handler updates the transform
67+
gContainer.attr("transform", event.transform);
68+
});
69+
70+
// 3) Attach the zoom to the SVG
71+
svg.call(zoomBehavior);
72+
5373
// Force simulation
5474
const simulation = d3.forceSimulation(graph.nodes)
5575
.force("link", d3.forceLink(graph.links)

docs/index.html

Lines changed: 0 additions & 171 deletions
This file was deleted.

0 commit comments

Comments
 (0)