in src/views/dashboard/related/trace/utils/d3-trace-list.ts [46:81]
constructor(el: HTMLDivElement, handleSelectSpan: (i: Trace) => void) {
this.handleSelectSpan = handleSelectSpan;
this.el = el;
this.width = el.getBoundingClientRect().width - 10;
this.height = el.getBoundingClientRect().height - 10;
d3.select(`.${this.el?.className} .trace-list`).remove();
this.svg = d3
.select(this.el)
.append("svg")
.attr("class", "trace-list")
.attr("width", this.width > 0 ? this.width : 10)
.attr("height", this.height > 0 ? this.height : 10)
.attr("transform", `translate(-5, 0)`);
this.tip = (d3tip as any)()
.attr("class", "d3-tip")
.offset([-8, 0])
.html((d: Recordable) => {
return `
<div class="mb-5">${d.data.label}</div>
${d.data.dur ? '<div class="sm">SelfDuration: ' + d.data.dur + "ms</div>" : ""}
${
d.data.endTime - d.data.startTime
? '<div class="sm">TotalDuration: ' + (d.data.endTime - d.data.startTime) + "ms</div>"
: ""
}
`;
});
this.prompt = (d3tip as any)()
.attr("class", "d3-tip")
.offset([-8, 0])
.html((d: any) => {
return `<div class="mb-5">${d.data.type}</div>`;
});
this.svg.call(this.tip);
this.svg.call(this.prompt);
}