Public
Edited
May 15, 2023
Insert cell
Insert cell
timedata = [
{ date: new Date("2023/10/05 13:00") },
{ date: new Date("2023/10/05 14:00") },
{ date: new Date("2023/10/05 15:00") },
{ date: new Date("2023/10/05 16:00") },
{ date: new Date("2023/10/05 17:00") },
{ date: new Date("2023/10/05 18:00") }
]
Insert cell
d3.timeDay.every(1).range(new Date(2015, 0, 2), new Date(2015, 0, 5))
Insert cell
diff = {
const diff = [];
for (var i = 0; i < timedata.length - 1; i++) {
diff.push({
difference: Math.floor(
(timedata[i + 1].date - timedata[i].date) / 1000 / 60
),
time: timedata[i + 1].date
});
}
return diff;
}
Insert cell
[...new Set(diff.map((d) => d.difference))].length
Insert cell
d3.utcMinute.every(60).range(new Date(2023, 0, 1), new Date(2023, 0, 7))
Insert cell

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more