From d3a886fefc839b1d89cdd0ef7a940f31e8a521d6 Mon Sep 17 00:00:00 2001 From: Chris Wilkinson Date: Thu, 11 Jul 2024 13:07:52 +0100 Subject: [PATCH] Ensure whole weeks are available on the scale when using them as intervals Refs #31 --- src/requests.md | 5 ++++- src/users.md | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/requests.md b/src/requests.md index e37c5bd..549de47 100644 --- a/src/requests.md +++ b/src/requests.md @@ -170,7 +170,10 @@ function requestsByLanguageTimeline({ width } = {}) { x: { label: '', domain: chosenYear - ? [new Date(chosenYear, 0, 1, 0, 0, 0, 0), new Date(chosenYear + 1, 0, 1, 0, 0, 0, 0)] + ? [ + d3.utcSunday.floor(new Date(chosenYear, 0, 1, 0, 0, 0, 0)), + d3.utcSunday.ceil(new Date(chosenYear + 1, 0, 1, 0, 0, 0, 0)), + ] : [d3.utcSunday.floor(firstRequest), d3.utcSunday.ceil(now)], }, marks: [ diff --git a/src/users.md b/src/users.md index 022e197..6524bef 100644 --- a/src/users.md +++ b/src/users.md @@ -89,7 +89,7 @@ function usersTimeline({ width } = {}) { d3.utcSunday.floor(new Date(chosenYear, 0, 1, 0, 0, 0, 0)), d3.utcSunday.ceil(new Date(chosenYear + 1, 0, 1, 0, 0, 0, 0)), ] - : [d3.utcSunday.floor(firstUser), d3.utcSunday.ceil(now)], + : [d3.utcMonth.floor(firstUser), d3.utcMonth.ceil(now)], }, marks: [ Plot.rectY(