chart = {
const div = d3
.create("div")
.attr("id", "phone-register")
.style("padding", "0!important")
.style("margin", "0!important")
.style("width", "500px")
.style("height", "100%")
.style("display", "flex")
.style("flex-direction", "column")
.style("align-items", "center")
.style("justify-content", "space-between")
.style("padding-bottom", "20px");
const group = div
.selectAll("div")
.data(data)
.join("div")
.style("position", "relative")
.style("margin-bottom", (d) =>
d.endDay ? "30px" : d.endWeek ? "70px" : "0px"
)
.style("font-size", "8px")
.attr("data-order", (d, i) => i + 1)
.attr("data-toggle", "tooltip")
.attr("data-placement", "left")
.attr(
"title",
(d) =>
`${d.weekday} ${d.date_formatted} ${
d.time_formatted
} 📞 ${typeAudioMessage(d.type)} ${
d.duration !== "0" ? d.duration : ""
}`
);
group
.append("div")
.attr("class", "info-desktop")
.style("position", "absolute")
.style("left", "-130px")
.style("top", "-25px")
.style("width", "150px")
.style("font-size", "9.5px")
.style("font-weight", 600)
.style("text-align", "left")
.html((d) =>
d.startDay
? `
<span>${d.weekday}, ${d.date_formatted}</span>`
: ""
);
group
.append("div")
.attr("class", "info-desktop")
.style("position", "absolute")
.style("left", (d) => (d.type === "success" ? "-200px" : "-145px"))
.style("left", (d) => typeAudioLeftPosition(d.type))
.style("width", "200px")
.style("text-align", "left")
.html(
(d) =>
`<span class=${d.type !== "no-call" ? "soundcite" : ""} data-url=${
d.type !== "no-call"
? `https://data.civio.es/posts/cita-previa-telefono-imv/${d.file}`
: ""
}>📞 ${typeAudioMessageShort(d.type)} ${
d.duration !== "0" ? `(${d.duration})` : ""
} ${d.time_formatted}</span>`
);
group
.append("img")
.attr("src", (d) => typeAudioIcon(d.type))
.style("width", (d) => (d.type === "success" ? "45px" : "18px"))
.style("height", (d) => (d.type === "success" ? "45px" : "18px"))
.style("position", "inherit")
.style("top", (d) => (d.type === "success" ? "-4px" : "-2px"));
return div.node();
}