Public
Edited
Jul 15, 2024
2 stars
Insert cell
Insert cell
Plot.plot({
marks: [
Plot.ruleY([0]),
Plot.axisX({ ticks: "3 months", tickFormat: customFormat() }),
Plot.gridX(),
Plot.line(aapl, { x: "Date", y: "Close" })
]
})
Insert cell
customFormat = () => {
const f = Plot.formatMonth("es-AR");
const seen = new Set(); // avoid repeating the year
return (d) => {
const month = f(d.getUTCMonth());
const year = d.getUTCFullYear();
if (seen.has(year)) return month;
seen.add(year);
return `${month}\n${year}`;
};
}
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