Skip to content

Fix bug causing DateTimeAxis to not display tick labels #3185#3187

Merged
j9ac9k merged 1 commit intopyqtgraph:masterfrom
tblum:fix_missing_tick_labels
Jan 25, 2025
Merged

Fix bug causing DateTimeAxis to not display tick labels #3185#3187
j9ac9k merged 1 commit intopyqtgraph:masterfrom
tblum:fix_missing_tick_labels

Conversation

@tblum
Copy link
Copy Markdown
Contributor

@tblum tblum commented Nov 8, 2024

This pull-request fixes the tick-labels not being displayed part of Issue #3185

I found that the bug in due to a floating point rounding error, which is not being taken into account in the QRectF.contains method. But the equality operator does take floating point rounding into account.

Demonstration of floating point rounding errer and work-around using intersected and ==

In [41]: QtCore.QRectF(0, -5, 600, 19.77).contains(QtCore.QRectF(300, 2, 30, 12.77))
Out[41]: True
In [42]: QtCore.QRectF(0, -5, 600, 19.775).contains(QtCore.QRectF(300, 2, 30, 12.775))
Out[42]: False
In [46]: QtCore.QRectF(0, -5, 600, 19.775) & QtCore.QRectF(300, 2, 30, 12.775) == QtCore.QRectF(300, 2, 30, 12 .775)
Out[46]: True

@oyvindlr
Copy link
Copy Markdown
Contributor

Just want to mention that I am experiencing the same issue and would be happy if it this PR is merged.

@j9ac9k
Copy link
Copy Markdown
Member

j9ac9k commented Jan 25, 2025

Thanks for the PR @tblum I didn't realize the floating point errors with the use of QRectF.contains() having this issue. We make use of .contains() in other parts of the library, but looks like most of our usages are for checking if a point is inside a QRectF

@j9ac9k j9ac9k merged commit 550bdac into pyqtgraph:master Jan 25, 2025
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.

3 participants