Allow skipping on certain period-changes #1925
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR introduces a new property named
skipPeriodChanges
toDateAxis
; aList
that accepts elements of typeTimeUnit
. When detecting a period-change, these units will be skipped in favor of a larger unit.Say we have data with
date
values as granular as a "second" and we are interested in having period changes formatted on "hour" so we show date changes in a different format. UsingdateAxis.periodChangeDateFormats.setKey("hour", "[bold]MMM d");
would produce an x-axis with:... - 22:00 - 23:00 -
Jan 20
- 01:00 - 02:00 - ...
Zooming in on the data enough to get the graph to show minutes would produce an x-axis with:
... - 23:00 - 23:30 - 00:00 - 00:30 - 01:00 - ...
Setting
dateAxis.periodChangeDateFormats.setKey("minute", "[bold]MMM d");
would make the x-axis be:... -
Jan 19
- 23:30 -
Jan 20
- 00:30 -
Jan 20
- ...
which doesn't appear desirable.However, with this change, setting
dateAxis.skipPeriodChanges.setAll(['minute', 'second']);
the x-axis would look like:... - 23:00 - 23:30 -
Jan 20
- 00:30 - 01:00 - ...
.The way this works is that if a certain unit it asked to be skipped, it simply looks for the next available time-unit for detection and formatting.