Fix annotation moving to the left when X axis PV changes#3579
Merged
georgweiss merged 2 commits intoOct 8, 2025
Merged
Conversation
When on plot the X axis PV changes the way that there is no anymore the same x value, the annotation was choosing the last index before. When X axis PV is changing every time, it was causing the issue that annotation was slowly going to the left and finally ending at the beginning. Finding the closest sample instead should fix the issue.
georgweiss
reviewed
Oct 6, 2025
georgweiss
left a comment
Collaborator
There was a problem hiding this comment.
Would be nice with unit test(s), but since the other methods are not covered...
Would it be OK if I add unit tests to this class on your branch?
Contributor
Author
|
Of course! |
That is possibly easier solution - instead of searching closest sample every update call we first search for less-or-equal sample and then greater-or-equal. Thanks to that we should keep more or less the same position as in the beginning.
Contributor
Author
|
Actually, I was testing annother approach and it may be simpler - instead of searching for closest sample, we can just alternate between less-or-equal and greated-or-equal sample. |
georgweiss
approved these changes
Oct 8, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
When on plot the X axis PV changes the way that here is no anymore the same x value, the annotation was choosing the last index before. We found the issue while using NTPVs on X and Y axis, which was recalculated every time in the IOC - so we never could find the same sample.
When X axis PV is changing every time, it was causing the issue that annotation was slowly going to the left and finally ending at the beginning.
Before:

Finding the closest sample instead should fix the issue (or at least limit it).