File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed
Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change 3636
3737SELECTION_WIDTH = 5
3838MAX = 11 # maximum number of colors or shapes (including Other)
39+ MAX_POINTS_IN_TOOLTIP = 5
40+
3941
4042class PaletteItemSample (ItemSample ):
4143 """A color strip to insert into legends for discretized continuous values"""
@@ -1227,8 +1229,16 @@ def point_data(p):
12271229
12281230 act_pos = self .scatterplot_item .mapFromScene (event .scenePos ())
12291231 points = self .scatterplot_item .pointsAt (act_pos )
1232+
12301233 if len (points ):
1231- text = "<hr/>" .join (point_data (point ) for point in points )
1234+ if len (points ) > MAX_POINTS_IN_TOOLTIP :
1235+ text = "{} instances<hr/>{}<hr/>..." .format (
1236+ len (points ),
1237+ "<hr/>" .join (point_data (point ) for point in points [:MAX_POINTS_IN_TOOLTIP ])
1238+ )
1239+ else :
1240+ text = "<hr/>" .join (point_data (point ) for point in points )
1241+
12321242 QToolTip .showText (event .screenPos (), text , widget = self .plot_widget )
12331243 return True
12341244 else :
You can’t perform that action at this time.
0 commit comments