Plot.plot({
y: { label: "Percentage", tickFormat: ".0%" },
x: { label: "Value" },
marks: [
Plot.axisX(window.data.bins, { tickFormat: d3.format("~s") }),
Plot.rectY(window.data.percentages, {
x1: (y, i) => window.data.bins[i],
x2: (y, i) => window.data.bins[i + 1],
fill: "steelblue",
insetRight: 0.5,
insetLeft: 0.5,
tip: true,
}),
Plot.lineY(window.data.percentages, {
x: (y, i) => window.data.bins[i] + (window.data.bins[i + 1] - window.data.bins[i]) / 2,
curve: "catmull-rom",
stroke: "red",
strokeOpacity: 0.5,
}),
Plot.ruleY([0]),
],
});