Skip to content

Commit

Permalink
use interval.ceil, if available
Browse files Browse the repository at this point in the history
  • Loading branch information
mbostock committed Aug 4, 2023
1 parent 132ab4f commit 2afe52a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
5 changes: 3 additions & 2 deletions src/marks/axis.js
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
20 changes: 10 additions & 10 deletions test/output/timeAxisOrdinalIrregular.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 2afe52a

Please sign in to comment.