Plot: Rightmost range of "now" on time-based x axis?

Is there a way to be presenting a time-based dataset where I hard-code in that the rightmost position on the time/x axis is now?

I tried Plot.tickX(data, {x: "created_at", range: [null, Date.now()]}) but no joy. :slight_smile:

It’s not currently possible to specify one part of the domain only (note: the dates belong to the domain, while the range is in pixels).

You could specify the whole domain with [d3.min(values), Date.now()]. Alternatively, in this particular example, you could add a mark such as:

Plot.tickX([Date.now()])

which would request the current date to be part of the default domain.

And, since you don’t want that mark to show anything, you can specify a constant falsey filter:

Plot.tickX([Date.now()], {filter: 0})

Not sure which of these possibilities is the easier to read and remember :slight_smile:

1 Like

Here’s a quick example of manually defining the two values of the domain: Untitled / Observable / Observable

2 Likes

Thank you @Fil and @shancarter!

I’ve tried marking you as both having the solution. :slight_smile:

1 Like