mirror of
https://github.com/tinygrad/tinygrad.git
synced 2026-04-29 03:00:14 -04:00
viz: add label to tooltip (#12021)
This commit is contained in:
@@ -228,7 +228,8 @@ async function renderProfiler() {
|
||||
const stepIdx = ctxs[ref.ctx+1].steps.findIndex((s, i) => i >= start && s.name == e.name);
|
||||
ref = stepIdx === -1 ? null : {ctx:ref.ctx, step:stepIdx};
|
||||
}
|
||||
const arg = { tooltipText:formatTime(e.dur)+(e.info != null ? "\n"+e.info : ""), ...ref };
|
||||
const htmlLabel = label.map(({color, st}) => `<span style="color:${color}">${st}</span>`).join('');
|
||||
const arg = { tooltipText:htmlLabel+"\n"+formatTime(e.dur)+(e.info != null ? "\n"+e.info : ""), ...ref };
|
||||
// offset y by depth
|
||||
shapes.push({x:e.st, y:levelHeight*depth, width:e.dur, height:levelHeight, arg, label, fillColor });
|
||||
}
|
||||
@@ -419,7 +420,7 @@ async function renderProfiler() {
|
||||
tooltip.style.display = "block";
|
||||
tooltip.style.left = (e.pageX+10)+"px";
|
||||
tooltip.style.top = (e.pageY)+"px";
|
||||
tooltip.innerText = foundRect.tooltipText;
|
||||
tooltip.innerHTML = foundRect.tooltipText;
|
||||
} else tooltip.style.display = "none";
|
||||
});
|
||||
canvas.addEventListener("mouseleave", () => document.getElementById("tooltip").style.display = "none");
|
||||
|
||||
Reference in New Issue
Block a user