Yes, handling different time scale is specifically the main purpose of the datetime axis configuration. Your largest scale is up to minutes? if it was only up to seconds, then I don’t think you’d need more than that the default “nice number” axis ticker, but once you get to minutes you’d want something that understands how to pick nice numbers on a minutes scale.
The datetime axis ticker is actually a CompositeTicker
that specifies several different tickers that each operate at different scales e.g.
tickers = Override(default=lambda: [
AdaptiveTicker(
mantissas=[1, 2, 5],
base=10,
min_interval=0,
max_interval=500*ONE_MILLI,
num_minor_ticks=0,
),
AdaptiveTicker(
mantissas=[1, 2, 5, 10, 15, 20, 30],
base=60,
min_interval=ONE_SECOND,
max_interval=30*ONE_MINUTE,
num_minor_ticks=0,
),
AdaptiveTicker(
mantissas=[1, 2, 4, 6, 8, 12],
base=24,
min_interval=ONE_HOUR,
max_interval=12*ONE_HOUR,
num_minor_ticks=0,
),
DaysTicker(days=list(range(1, 32))),
...
In principle, you could define your own CompositeTicker
subclass, that specifies custom tickers to use at different scales, that understand whatever datetime units your data is in. Unfortunately, at present there is not a super simple way for you to implement these new custom tickers. There is a CustomJSTickFormatter
that enables users to define tick formatters by just providing a snippet of JavaScript implementation code. But a corresponding CustomJSTicker
does not exist yet:
Add CustomJSTicker · Issue #13130 · bokeh/bokeh · GitHub
Until this is added, the only way to provide a custom ticker is to implement a complete custom extension, which is a fairly advanced and involved undertaking.
If you can forego “nice” minutes scale, then I think the standard BasicTickFormatter
that chooses “nice” base-10 numbers for ticks (basically, multiples of 2, 5, and 10), along with a CustomJSTicker
would suffice. Otherwise, I don’t have a super simple suggestion for you at the time being.