Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow skipping on certain period-changes #1925

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

AMoo-Miki
Copy link

This PR introduces a new property named skipPeriodChanges to DateAxis; a List that accepts elements of type TimeUnit. 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. Using dateAxis.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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant