run ./check and fix errors

This commit is contained in:
GithubAnon0000 2025-04-26 16:45:32 +02:00
parent 2d7ae6c440
commit 258b2b3f8d

View file

@ -155,33 +155,35 @@ export function renderButtons(
)
)
.attr("direction", "ltr");
// Add a timeout to ensure that the text elements are populated
setTimeout(() => {
svg.select<SVGGElement>(".x-ticks").selectAll("text")
.each(function(d) {
const current_text_element = this;
const current_text_element_content = current_text_element.textContent;
current_text_element.textContent = "";
// Add a timeout to ensure that the text elements are populated
setTimeout(() => {
svg.select<SVGGElement>(".x-ticks").selectAll<SVGTextElement, GroupKind>("text")
.each(function(this: SVGTextElement, d: GroupKind) {
if (!(this instanceof SVGElement)) {
return;
}
const current_text_element_content = this.textContent;
// Create a tspan for the text content (the "kind" part)
const tspan = document.createElementNS("http://www.w3.org/2000/svg", "tspan");
tspan.textContent = current_text_element_content;
tspan.setAttribute("dy", "0.5em");
// Create a tspan for the percentage
const tspan2 = document.createElementNS("http://www.w3.org/2000/svg", "tspan");
tspan2.textContent = `\u200e(${totalCorrect(d).percent}%)`;
tspan2.setAttribute("dy", "1em");
tspan2.setAttribute("dx", "-4em"); // i realized it works. It's probably a coincidence and a hack
this.textContent = "";
current_text_element.appendChild(tspan);
current_text_element.appendChild(tspan2);
});
}, 0);
// Create a tspan for the text content (the "kind" part)
const tspan = document.createElementNS("http://www.w3.org/2000/svg", "tspan");
tspan.textContent = current_text_element_content;
tspan.setAttribute("dy", "0.5em");
// \u200e(${totalCorrect(d).percent}%)
// Create a tspan for the percentage
const tspan2 = document.createElementNS("http://www.w3.org/2000/svg", "tspan");
tspan2.textContent = `\u200e(${totalCorrect(d).percent}%)`;
tspan2.setAttribute("dy", "1em");
tspan2.setAttribute("dx", "-4em"); // i realized it works. It's probably a coincidence and a hack
this.appendChild(tspan);
this.appendChild(tspan2);
});
}, 0);
// \u200e(${totalCorrect(d).percent}%)
const xButton = scaleBand()
.domain(["1", "2", "3", "4"])