File size: 508 Bytes
1fd7c45 b5e0335 1fd7c45 313c51c 1fd7c45 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | import * as Plot from "npm:@observablehq/plot";
export function timeline(events, {width, height} = {}) {
return Plot.plot({
width,
height,
marginTop: 30,
x: {nice: true, label: null, tickFormat: "", interval: 1},
y: {axis: null},
marks: [
Plot.ruleX(events, {x: "year", y: "y", markerEnd: "dot", strokeWidth: 2.5}),
Plot.ruleY([0]),
// Plot.text(events, {x: "year", y: "y", text: "name", lineAnchor: "bottom", dy: -10, lineWidth: 10, fontSize: 12})
]
});
}
|