Skip to content

Use static offsets for panning rounded time scale#474

Merged
kurkle merged 1 commit intochartjs:masterfrom
kurkle:time-round
Apr 28, 2021
Merged

Use static offsets for panning rounded time scale#474
kurkle merged 1 commit intochartjs:masterfrom
kurkle:time-round

Conversation

@kurkle
Copy link
Copy Markdown
Member

@kurkle kurkle commented Apr 27, 2021

Fixes #388

The time scale rounds down. So when the max goes some amount less than a day over the max, it is rounded down and thus the scale is not changed. On the other hand if we go just a millisecond lower than min, it is immediately changed by a full day.

This adds offset based on the round value, to halfway of the round. So in the day case, 12 hours is added to the min/max before applying the delta.

This alone is not enough, because if the move is not big enough, then there is no change and the delta is reset.
=> Cumulative delta is stored in state until a change occurs.

@kurkle kurkle added the bug label Apr 27, 2021
@kurkle kurkle merged commit 7289efd into chartjs:master Apr 28, 2021
@kurkle kurkle deleted the time-round branch April 28, 2021 08:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

When round is set, I can not pan the graph to the right.

2 participants