feat: burg groups - support styling

This commit is contained in:
Azgaar 2024-12-19 22:35:36 +01:00
parent 4185611791
commit c86f7de9de
6 changed files with 146 additions and 127 deletions

View file

@ -10,6 +10,7 @@ function drawBurgLabels() {
const labelGroup = burgLabels.select("#" + name);
if (labelGroup.empty()) continue;
const dy = labelGroup.attr("data-dy");
labelGroup
.selectAll("text")
@ -20,7 +21,7 @@ function drawBurgLabels() {
.attr("data-id", d => d.i)
.attr("x", d => d.x)
.attr("y", d => d.y)
.attr("dy", "-0.4em")
.attr("dy", dy + "em")
.text(d => d.name);
}
@ -28,14 +29,16 @@ function drawBurgLabels() {
}
function drawBurgLabel(burg) {
burgLabels
.select("#" + burg.group)
const group = burgLabels.select("#" + burg.group);
const dy = labelGroup.attr("data-dy");
group
.append("text")
.attr("id", "burgLabel" + burg.i)
.attr("data-id", burg.i)
.attr("x", burg.x)
.attr("y", burg.y)
.attr("dy", "-0.4em")
.attr("dy", dy + "em")
.text(burg.name);
}