From 4b00f2bb53be47598f12e265ccf1e67469dd3248 Mon Sep 17 00:00:00 2001 From: astaric Date: Wed, 28 Mar 2018 15:09:16 +0200 Subject: [PATCH 1/2] scatterplot: limit number of points displayed in tooltip --- Orange/widgets/visualize/owscatterplotgraph.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Orange/widgets/visualize/owscatterplotgraph.py b/Orange/widgets/visualize/owscatterplotgraph.py index 764e85e4152..4d91cc4a53c 100644 --- a/Orange/widgets/visualize/owscatterplotgraph.py +++ b/Orange/widgets/visualize/owscatterplotgraph.py @@ -36,6 +36,8 @@ SELECTION_WIDTH = 5 MAX = 11 # maximum number of colors or shapes (including Other) +MAX_POINTS_IN_TOOLTIP = 20 + class PaletteItemSample(ItemSample): """A color strip to insert into legends for discretized continuous values""" @@ -1227,8 +1229,16 @@ def point_data(p): act_pos = self.scatterplot_item.mapFromScene(event.scenePos()) points = self.scatterplot_item.pointsAt(act_pos) + if len(points): - text = "
".join(point_data(point) for point in points) + if len(points) > MAX_POINTS_IN_TOOLTIP: + text = "{} instances
{}
...".format( + len(points), + "
".join(point_data(point) for point in points[:5]) + ) + else: + text = "
".join(point_data(point) for point in points) + QToolTip.showText(event.screenPos(), text, widget=self.plot_widget) return True else: From ca678b5f733d327393a5090639108d303b8b25e8 Mon Sep 17 00:00:00 2001 From: astaric Date: Fri, 30 Mar 2018 09:47:00 +0200 Subject: [PATCH 2/2] scatterplot: reduce MAX_POINTS_IN_TOOLTIP --- Orange/widgets/visualize/owscatterplotgraph.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Orange/widgets/visualize/owscatterplotgraph.py b/Orange/widgets/visualize/owscatterplotgraph.py index 4d91cc4a53c..4b0ad61b0cb 100644 --- a/Orange/widgets/visualize/owscatterplotgraph.py +++ b/Orange/widgets/visualize/owscatterplotgraph.py @@ -36,7 +36,7 @@ SELECTION_WIDTH = 5 MAX = 11 # maximum number of colors or shapes (including Other) -MAX_POINTS_IN_TOOLTIP = 20 +MAX_POINTS_IN_TOOLTIP = 5 class PaletteItemSample(ItemSample): @@ -1234,7 +1234,7 @@ def point_data(p): if len(points) > MAX_POINTS_IN_TOOLTIP: text = "{} instances
{}
...".format( len(points), - "
".join(point_data(point) for point in points[:5]) + "
".join(point_data(point) for point in points[:MAX_POINTS_IN_TOOLTIP]) ) else: text = "
".join(point_data(point) for point in points)