Better control over Scale formatting
- Dominant language
- Python
- Stars
- 305
- Forks
- 97
- PR merge metrics
- No merged PRs in 30d
Description
**Problem Description**
When using a complex scale system, such as the `CalendarScaleSystem`, it is hard to change the labelling being used. This is because the formatter is an attribute of the scale, so needs to be set on every sub-scale of the scale system. The scale system is supposed to offset this somewhat by picking the first scale that matches a tick to use as its label, but the `CalendarScaleSystem` and `TimeFormatter` currently don't do this; I suspect to handle timezone conversions correctly (eg. a day or hour boundary in one timezone may not be in another - particularly when you take into account non-hour offsets like Adelaide time).
Since the scales in the scale system are often global objects, this also means that if you change the formatter for one plot, it affects all plots.
**Reproduction Steps:**
See discussion and examples in #545
**Expected behavior:**
Ideally, you'd like to be able to write something like: `CalendarScaleSystem(formatter=my_formatter)` and have it use the supplied formatter for all scales.
Similarly, it should be easy to generate standard time scales with a different formatter, something like: `CalendarScaleSystem(scales=make_HMS_scales(formatter=my_formatter))`
Alternatively, it may be possible to architect the scale system so that the `TimeScale` class correctly generates labels for its resolution and timezone, so that the complexity of `TimeFormatter` can be removed: hour and day tick marks should be generated in the correct timezone, and so they can simply display the hour and day in an appropriate format; each `TimeScale` resolution will then end up having a different formatter depending on the resolution being used. Even then, the ability to easily override or create variant timescales with different formatting would be useful.
**OS, Python version:** All (but Windows has some additional quirks about times in the UK around the Epoch).
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.