viz: split all long labels with ... (#14794)

This commit is contained in:
qazal
2026-02-16 18:18:42 +08:00
committed by GitHub
parent d213fe95a0
commit 2b36708c6d

View File

@@ -353,7 +353,11 @@ async function renderProfiler(path, unit, opts) {
colorMap.set(colorKey, d3.rgb(color));
}
const fillColor = colorMap.get(colorKey).brighter(0.3*depth).toString();
const label = parseColors(e.name).map(({ color, st }) => ({ color, st, width:ctx.measureText(st).width }));
const label = parseColors(e.name).flatMap(({ color, st }) => {
const parts = [];
for (let i=0; i<st.length; i+=4) { const part = st.slice(i, i+4); parts.push({ color, st:part, width:ctx.measureText(part).width }); }
return parts;
});
let shapeRef = e.ref;
if (shapeRef != null) { ref = {ctx:e.ref, step:0}; shapeRef = ref; }
else if (ref != null) {