Open mbostock opened 1 year ago
I also had a thought where it’d be cool if you could somehow apply the bin transform to the axis mark, so that you could then bin the ticks and easily compute the extent and midpoint of each time interval. But that’s not readily doable with the axis mark because the axis mark uses an initializer to compute the ticks (running after scale construction). And I don’t think it’s currently possible to run an initializer after the axis mark’s built-in initializer, even if we were to adapt the bin transform to let it run as an initializer. I guess we could have a postinitialize option but that feels pretty specific and low-level!
It might be nice to have a transform that takes x1 and x2 and derives an x channel, as the mid helper does internally (preserving dates as needed). And if you had an x channel and an interval option, it could derive an x that represents the midpoint of the associated intervals. And same for y.
Ref. https://talk.observablehq.com/t/mid-align-axisx-in-a-plot/7857/1