Skip to content

Commit 2afe52a

Browse files
committed
use interval.ceil, if available
1 parent 132ab4f commit 2afe52a

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

src/marks/axis.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -542,12 +542,13 @@ function axisMark(mark, k, ariaLabel, data, options, initialize) {
542542
// ordinal time
543543
// TODO determine whether the interval is utc or local time?
544544
// TODO assert that the interval is one of utcTick’s known intervals?
545+
// TODO add ceil to the RangeIntervalImplementation interface?
545546
if (isTimeInterval(scale.interval)) {
546-
const type = "utc"; // TODO detect whether interval is utc or local
547+
const type = "utc";
547548
const [start, stop] = extent(data);
548549
if (interval) {
549550
data = maybeRangeInterval(interval, type).range(start, stop);
550-
data = data.map(scale.interval.floor, scale.interval);
551+
data = data.map(scale.interval.ceil ?? scale.interval.floor, scale.interval);
551552
} else {
552553
if (ticks === undefined) {
553554
const [min, max] = extent(scale.range());

test/output/timeAxisOrdinalIrregular.svg

Lines changed: 10 additions & 10 deletions
Loading

0 commit comments

Comments
 (0)