mirror of
https://github.com/ankitects/anki.git
synced 2025-09-23 16:26:40 -04:00
run ./check and fix errors
This commit is contained in:
parent
2d7ae6c440
commit
258b2b3f8d
1 changed files with 25 additions and 23 deletions
|
@ -156,32 +156,34 @@ export function renderButtons(
|
||||||
)
|
)
|
||||||
.attr("direction", "ltr");
|
.attr("direction", "ltr");
|
||||||
|
|
||||||
// Add a timeout to ensure that the text elements are populated
|
// Add a timeout to ensure that the text elements are populated
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
svg.select<SVGGElement>(".x-ticks").selectAll("text")
|
svg.select<SVGGElement>(".x-ticks").selectAll<SVGTextElement, GroupKind>("text")
|
||||||
.each(function(d) {
|
.each(function(this: SVGTextElement, d: GroupKind) {
|
||||||
const current_text_element = this;
|
if (!(this instanceof SVGElement)) {
|
||||||
const current_text_element_content = current_text_element.textContent;
|
return;
|
||||||
|
}
|
||||||
|
const current_text_element_content = this.textContent;
|
||||||
|
|
||||||
current_text_element.textContent = "";
|
this.textContent = "";
|
||||||
|
|
||||||
// Create a tspan for the text content (the "kind" part)
|
// Create a tspan for the text content (the "kind" part)
|
||||||
const tspan = document.createElementNS("http://www.w3.org/2000/svg", "tspan");
|
const tspan = document.createElementNS("http://www.w3.org/2000/svg", "tspan");
|
||||||
tspan.textContent = current_text_element_content;
|
tspan.textContent = current_text_element_content;
|
||||||
tspan.setAttribute("dy", "0.5em");
|
tspan.setAttribute("dy", "0.5em");
|
||||||
|
|
||||||
// Create a tspan for the percentage
|
// Create a tspan for the percentage
|
||||||
const tspan2 = document.createElementNS("http://www.w3.org/2000/svg", "tspan");
|
const tspan2 = document.createElementNS("http://www.w3.org/2000/svg", "tspan");
|
||||||
tspan2.textContent = `\u200e(${totalCorrect(d).percent}%)`;
|
tspan2.textContent = `\u200e(${totalCorrect(d).percent}%)`;
|
||||||
tspan2.setAttribute("dy", "1em");
|
tspan2.setAttribute("dy", "1em");
|
||||||
tspan2.setAttribute("dx", "-4em"); // i realized it works. It's probably a coincidence and a hack
|
tspan2.setAttribute("dx", "-4em"); // i realized it works. It's probably a coincidence and a hack
|
||||||
|
|
||||||
current_text_element.appendChild(tspan);
|
this.appendChild(tspan);
|
||||||
current_text_element.appendChild(tspan2);
|
this.appendChild(tspan2);
|
||||||
});
|
});
|
||||||
}, 0);
|
}, 0);
|
||||||
|
|
||||||
// \u200e(${totalCorrect(d).percent}%)
|
// \u200e(${totalCorrect(d).percent}%)
|
||||||
|
|
||||||
const xButton = scaleBand()
|
const xButton = scaleBand()
|
||||||
.domain(["1", "2", "3", "4"])
|
.domain(["1", "2", "3", "4"])
|
||||||
|
|
Loading…
Reference in a new issue