Skip to content

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.

1 participant