def __init__(self, n_attributes, y_values, color, name=""): OWCurve.__init__(self, tooltip=name) self._item = QGraphicsPathItem(self) self.path = QPainterPath() self.fitted = False self.n_attributes = n_attributes self.n_rows = int(len(y_values) / n_attributes) self.set_style(OWCurve.Lines) if isinstance(color, tuple): self.set_pen(QPen(QColor(*color))) else: self.set_pen(QPen(QColor(color))) x_values = list(range(n_attributes)) * self.n_rows self.set_data(x_values, y_values)
def _draw_curves(self, selected_curves): n_attr = len(self.attributes) for color, y_values in sorted(selected_curves.items()): n_rows = int(len(y_values) / n_attr) x_values = list(range(n_attr)) * n_rows curve = OWCurve() curve.set_style(OWCurve.Lines) curve.set_color(QColor(*color)) curve.set_segment_length(n_attr) curve.set_data(x_values, y_values) curve.attach(self)