From a484f9e4d5856d24795306397148671c5bacf47e Mon Sep 17 00:00:00 2001 From: robert Date: Fri, 14 Jun 2019 11:49:35 +0200 Subject: [PATCH] owradviz: limit number of vars in VizRank --- Orange/widgets/visualize/owradviz.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/Orange/widgets/visualize/owradviz.py b/Orange/widgets/visualize/owradviz.py index c2f2ccbc728..d96b698d33b 100644 --- a/Orange/widgets/visualize/owradviz.py +++ b/Orange/widgets/visualize/owradviz.py @@ -29,6 +29,10 @@ from Orange.widgets.visualize.utils.widget import OWAnchorProjectionWidget +MAX_DISPLAYED_VARS = 20 +MAX_LABEL_LEN = 16 + + class RadvizVizRank(VizRankDialog, OWComponent): captionTitle = "Score Plots" n_attrs = Setting(3) @@ -48,8 +52,9 @@ def __init__(self, master): self.n_neighbors = 10 box = gui.hBox(self) + max_n_attrs = min(MAX_DISPLAYED_VARS, len(master.model_selected)) self.n_attrs_spin = gui.spin( - box, self, "n_attrs", 3, 99, label="Maximum number of variables: ", + box, self, "n_attrs", 3, max_n_attrs, label="Maximum number of variables: ", controlWidth=50, alignment=Qt.AlignRight, callback=self._n_attrs_changed) gui.rubber(box) self.last_run_n_attrs = None @@ -130,7 +135,8 @@ def check_preconditions(self): return False elif not master.btn_vizrank.isEnabled(): return False - self.n_attrs_spin.setMaximum(len(master.model_selected)) + self.n_attrs_spin.setMaximum(min(MAX_DISPLAYED_VARS, + len(master.model_selected))) return True def on_row_clicked(self, index): @@ -205,9 +211,6 @@ def stopped(self): self.n_attrs_spin.setDisabled(False) -MAX_LABEL_LEN = 16 - - class OWRadvizGraph(OWGraphWithAnchors): def __init__(self, scatter_widget, parent): super().__init__(scatter_widget, parent)