Skip to content

Commit 14d5276

Browse files
committed
owlinearprojection: limit the length of variable lable
1 parent 54aeb62 commit 14d5276

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Orange/widgets/visualize/owlinearprojection.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636

3737

3838
MAX_DISPLAYED_VARS = 20
39+
MAX_LABEL_LEN = 20
3940

4041

4142
class LinearProjectionVizRank(VizRankDialog, OWComponent):
@@ -218,7 +219,11 @@ def update_anchors(self):
218219
if self.anchor_items is None:
219220
self.anchor_items = []
220221
for point, label in zip(points, labels):
221-
anchor = AnchorItem(line=QLineF(0, 0, *point), text=label)
222+
anchor = AnchorItem(line=QLineF(0, 0, *point))
223+
anchor._label.setToolTip(f"<b>{label}</b>")
224+
label = label[:MAX_LABEL_LEN - 3] + "..." if len(label) > MAX_LABEL_LEN else label
225+
anchor.setText(label)
226+
222227
visible = self.always_show_axes or np.linalg.norm(point) > r
223228
anchor.setVisible(visible)
224229
anchor.setPen(pg.mkPen((100, 100, 100)))

0 commit comments

Comments
 (0)