-
-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FIX] boxplot labels overlap #3011
Conversation
Codecov Report
@@ Coverage Diff @@
## master #3011 +/- ##
==========================================
- Coverage 82.19% 82.16% -0.04%
==========================================
Files 335 334 -1
Lines 57688 57713 +25
==========================================
+ Hits 47417 47420 +3
- Misses 10271 10293 +22 |
9c9d523
to
ba2a0f3
Compare
|
||
if self.__max_width is None or self.boundingRect().width() < self.__max_width: | ||
return | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ales-erjavec Do you perhaps have any ideas how to limit label painting to some rect? So that we would not need to draw white rects over label parts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- set clip rect on the painter
- actually implement bounded text painting (QPainter has quite a few drawText overloads for bounded text painting, also see QFontMetrics.elidedText)
@astaric, I tried to clip instead of draw. Could you see if it still works as expected? |
81bea8f
to
4ed70d0
Compare
4ed70d0
to
8cad7aa
Compare
@markotoplak, while clip works, eliding works better |
ca0f248
to
cf16cea
Compare
Needed to ensure paint method gets executed
cf16cea
to
f6381d5
Compare
@@ -972,6 +1027,44 @@ def send_report(self): | |||
if text: | |||
self.report_caption(text) | |||
|
|||
class Label(QGraphicsSimpleTextItem): | |||
"""Boxplot Label with settable maxWidth""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we move something like this to the gui module, so it can be reused elsewhere?
edit: not gui as that has elements for gui construction, but maybe somewhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When anyone else needs a label like this, it can be moved and imported from there. Until then, I see no point in further polluting the gui namespace.
The label extending to the right was a "feature", but since cropping of the visualization does not account for the label, I have removed it. |
No idea why coverage does not get updated, but the results (https://codecov.io/gh/biolab/orange3/pull/3011/diff) indicate that diff coverage is at 96.39% :) |
Yolo. |
Issue
When labels are wider than their respective bars in a boxplot, labels overlap:
Description of changes
Limit (all but the last) label width to the width of the bar they are labelling. Hide labels for very short bars (unless the whole label can be displayed in available space).
Includes