From 25f2a5233a5f4c9319a6cd2d72ad0621a406e363 Mon Sep 17 00:00:00 2001 From: Mike Bostock Date: Fri, 4 Aug 2023 16:43:56 -0700 Subject: [PATCH] use interval.ceil, if available --- src/marks/axis.js | 5 +- test/output/timeAxisOrdinalIrregular.svg | 123 ----------------------- 2 files changed, 3 insertions(+), 125 deletions(-) delete mode 100644 test/output/timeAxisOrdinalIrregular.svg diff --git a/src/marks/axis.js b/src/marks/axis.js index 39b287520fd..5d5c8190bdb 100644 --- a/src/marks/axis.js +++ b/src/marks/axis.js @@ -542,12 +542,13 @@ function axisMark(mark, k, ariaLabel, data, options, initialize) { // ordinal time // TODO determine whether the interval is utc or local time? // TODO assert that the interval is one of utcTick’s known intervals? + // TODO add ceil to the RangeIntervalImplementation interface? if (isTimeInterval(scale.interval)) { - const type = "utc"; // TODO detect whether interval is utc or local + const type = "utc"; const [start, stop] = extent(data); if (interval) { data = maybeRangeInterval(interval, type).range(start, stop); - data = data.map(scale.interval.floor, scale.interval); + data = data.map(scale.interval.ceil ?? scale.interval.floor, scale.interval); } else { if (ticks === undefined) { const [min, max] = extent(scale.range()); diff --git a/test/output/timeAxisOrdinalIrregular.svg b/test/output/timeAxisOrdinalIrregular.svg deleted file mode 100644 index 07a68339c61..00000000000 --- a/test/output/timeAxisOrdinalIrregular.svg +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - - - - - - - - - 0 - 20 - 40 - 60 - 80 - 100 - 120 - 140 - 160 - - - ↑ Close - - - - - - - - - - 2013 - 2014 - 2015 - 2016 - 2017 - - - 2013-05-13 - 2013-05-20 - 2013-06-17 - 2013-07-15 - 2013-08-12 - 2013-09-09 - 2013-10-07 - 2013-11-04 - 2013-12-02 - 2013-12-30 - 2014-01-27 - 2014-02-24 - 2014-03-24 - 2014-04-21 - 2014-05-19 - 2014-06-16 - 2014-07-14 - 2014-08-11 - 2014-09-08 - 2014-10-06 - 2014-11-03 - 2014-12-01 - 2014-12-29 - 2015-01-26 - 2015-02-23 - 2015-03-23 - 2015-04-20 - 2015-05-18 - 2015-06-15 - 2015-07-13 - 2015-08-10 - 2015-09-08 - 2015-10-05 - 2015-11-02 - 2015-11-30 - 2015-12-28 - 2016-01-25 - 2016-02-22 - 2016-03-21 - 2016-04-18 - 2016-05-16 - 2016-06-13 - 2016-07-11 - 2016-08-08 - 2016-09-06 - 2016-10-03 - 2016-10-31 - 2016-11-28 - 2016-12-27 - 2017-01-23 - 2017-02-21 - 2017-03-20 - 2017-04-17 - 2017-05-15 - 2017-06-12 - 2017-07-10 - 2017-08-07 - 2017-09-05 - 2017-10-02 - 2017-10-30 - 2017-11-27 - 2017-12-26 - 2018-01-22 - 2018-02-20 - 2018-03-19 - 2018-04-16 - - \ No newline at end of file