Public
Edited
Mar 28
1 fork
11 stars
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
function getNumDays(endDate, startDate) {
return Math.ceil((endDate.getTime() - startDate.getTime()) / (1000 * 3600 * 24)) + 1;
}
Insert cell
// Assume you have an array of runs with each run having a `date` property
runsPerMonth = {};
runs.forEach(run => {
let month = run.date.getMonth(); // get the month of the run
if (!runsPerMonth[month]) runsPerMonth[month] = 0;
runsPerMonth[month]++;
});

let data = Object.entries(runsPerMonth).map(([month, count]) => ({month, count}));

Plot.plot({
marks: [
Plot.barX(data, {x: "month", y: "count"})
]
})
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