Skip to content

Commit

Permalink
fix: Resolve constant variable reassignment in visualization code
Browse files Browse the repository at this point in the history
  • Loading branch information
sanity committed Nov 30, 2024
1 parent 4e75b61 commit 4f491ec
Showing 1 changed file with 1 addition and 56 deletions.
57 changes: 1 addition & 56 deletions hugo-site/static/html/eventual_convergence_viz.html
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ <h1 class="title">Freenet Eventual Convergence Simulation</h1>
const treeLayout = d3.tree().size([width, height - 200]);
treeLayout(root);

const svg = d3
let svg = d3
.select("body")
.append("svg")
.attr("width", width)
Expand Down Expand Up @@ -266,61 +266,6 @@ <h1 class="title">Freenet Eventual Convergence Simulation</h1>
});
}
</script>
<script>
function drawTree() {
const treeLayout = d3.tree().size([width, height - 200]);
treeLayout(root);

svg = d3
.select("body")
.append("svg")
.attr("width", width)
.attr("height", height)
.append("g")
.attr("transform", "translate(0, 100)");

// Draw links
const link = svg
.selectAll(".link")
.data(root.links())
.enter()
.append("path")
.attr("class", "link")
.attr(
"d",
d3
.linkVertical()
.x((d) => d.x)
.y((d) => d.y)
)
.attr("stroke", "#1e90ff")
.attr("stroke-width", 2);

// Draw nodes as pie charts
const node = svg
.selectAll(".node")
.data(root.descendants())
.enter()
.append("g")
.attr("class", "node")
.attr("transform", (d) => `translate(${d.x},${d.y})`)
.attr("id", (d) => `node-${d.data.id}`);

node.each(function (d) {
const nodeGroup = d3.select(this);
drawPie(nodeGroup, d.data.receivedColors);
});

node
.on("mouseover", function (event, d) {
d3.select(this).append("title").text(d.data.receivedColors.join(", "));
})
.on("click", function (event, d) {
initiatePropagation(d);
});
}

drawTree();
</script>
</body>
</html>

0 comments on commit 4f491ec

Please sign in to comment.