Public
Edited
Sep 15, 2023
2 forks
1 star
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
x = d3
.scaleLinear()
.domain([d3.min(data, (d) => d.intro), d3.max(data, (d) => d.res)])
.range([margin.left, width - margin.right])
Insert cell
y = d3
.scaleBand()
.domain(data.map((d) => d.name))
.range([margin.top, height - margin.bottom])
.round(true)
Insert cell
xAxis = (g) =>
g
.attr("transform", `translate(0,${height - margin.bottom})`)
.call(d3.axisBottom(x).tickFormat(d3.format(".0f")))
Insert cell
Insert cell
lang = "de"
Insert cell
pd_de = "Zeitleiste für Antibiotika. Die Zeitpunkte der Einführung des Medikaments und der anschließenden Entwicklung der Resistenz sind durch die Enden gekennzeichnet. Der verblasste Bereich soll zeigen, dass die erste Beobachtung einer Resistenz nicht unbedingt mit einem vollständigen Verlust der Wirksamkeit der Behandlung gleichzusetzen ist."
Insert cell
pc_plot_1 = htl.html`${pd_de} © Living Lab, nach McClure, N.S., Day, T.: <a href="
https://doi.org/10.1098/rspb.2014.1861" target="_blank">A theoretical examination of the relative importance of evolution management and drug development for managing resistance</a>. Proceedings of the Royal Society B 281, 2014, fig. 1 / <a href="https://creativecommons.org/licenses/by/4.0/legalcode" target="_blank">CC BY 4.0</a>`
Insert cell
pc_plot_2 = htl.html`${pd_de} © Living Lab, nach McClure, N.S., Day, T.: <a href="
https://doi.org/10.1098/rspb.2014.1861" target="_blank">A theoretical examination of the relative importance of evolution management and drug development for managing resistance</a>. Proceedings of the Royal Society B 281, 2014, fig. 1 / <a href="https://creativecommons.org/licenses/by/4.0/legalcode" target="_blank">CC BY 4.0</a>`
Insert cell
resMax = d3.max(data, (d) => d.res)
Insert cell
introMin = d3.min(data, (d) => d.intro)
Insert cell
data = FileAttachment("AMR_timeline_2023_07_17_a@1.csv")
.csv({ typed: true })
.then((data) => {
const parseNumbers = (d) => Math.round(d);
if (lang == "de") {
return data.map((row) => ({
name: row.name_de,
intro: parseNumbers(row.intro),
res: parseNumbers(row.res),
type: row.type
}));
} else {
return data.map((row) => ({
name: row.name_en,
intro: parseNumbers(row.intro),
res: parseNumbers(row.res),
type: row.type
}));
}
})
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more