class Tooltip {
constructor() {
this._one = svg`<text class=ttText y="-52"></text>`;
this._two = svg`<text class=ttText y="-30"></text>`;
this._three = svg`<text class=ttText y="-10"></text>`;
this.node = svg`<g pointer-events="none" display="none" font-family="Montserrat" font-size="18" text-anchor="middle">
<rect x="-120" width="240" y="-70" height="68" stroke="rgb(0,0,0, 0.1)" fill="rgb(255,255,255, 0.6)" rx="5"></rect>
${this._one}
${this._two}
${this._three}
</g>`
;
}
show(d, b, c, e) {
console.log(d)
this.node.removeAttribute("display");
this.node.setAttribute("transform", `translate(${x(d.x)},${y(d.y)})`);
this._one.textContent = d.name;
this._two.textContent = d.rating + " out of 10";
this._three.textContent = d.touches + " touches & " + d.passes + " passes";
}
move(d, b, c) {
this.node.setAttribute("transform", `translate(${x(d.x)},${y(d.y)-size(d.touches)})`);
}
hide() {
this.node.setAttribute("display", "none");
}
}