Skip to content

fix: correct YRangeCursorTool annotation when cursors are inverted#307

Open
hieusats wants to merge 1 commit intoDataLab-Platform:mainfrom
hieusats:fix/yrange-cursor-annotation
Open

fix: correct YRangeCursorTool annotation when cursors are inverted#307
hieusats wants to merge 1 commit intoDataLab-Platform:mainfrom
hieusats:fix/yrange-cursor-annotation

Conversation

@hieusats
Copy link
Copy Markdown

Summary

Fixes #306

When the top Y-range cursor is dragged below the bottom cursor (ymin > ymax), the annotation label showed an invalid inequality (e.g. 5 < y < 2) and a negative delta value (∆y=-3).

Changes

In datalab/gui/docks.pyCurveStatsToolFunctions.set_labelfuncs():

  • Line 97: Use min(ymin, ymax) / max(ymin, ymax) to always display the smaller value on the left
  • Line 98: Use abs(ymax - ymin) so delta is always positive

Test Plan

  • Verified the fix logic: min()/max() ensures correct ordering, abs() ensures positive delta
  • Manual test: drag top cursor below bottom cursor, verify annotation shows valid inequality and positive delta

When the top Y-range cursor is dragged below the bottom cursor
(ymin > ymax), the annotation label showed an invalid inequality
(e.g. '5 < y < 2') and a negative delta (no physical meaning).

Fix by sorting the min/max values and using abs() for the delta.

Fixes DataLab-Platform#306
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.

YRangeCursorTool: annotation shows incorrect inequality and negative ∆y when y0 > y1

1 participant