(self)
Update the graph (pen width) to show the current selection.
        Filter and output the data.
Update the graph (pen width) to show the current selection.
        Filter and output the data.
Update the graph ( pen width ) to show the current selection . Filter and output the data .
def update_selection(self):
        """
        Update the graph (pen width) to show the current selection.
        Filter and output the data.
        """
        if self.areas is None or not self.selection:
            self.Outputs.selected_data.send(None)
            self.Outputs.annotated_data.send(create_annotated_table(self.data, []))
            return

        filts = []
        for i, area in enumerate(self.areas):
            if i in self.selection:
                width = 4
                val_x, val_y = area.value_pair
                filts.append(
                    filter.Values([
                        filter.FilterDiscrete(self.attr_x.name, [val_x]),
                        filter.FilterDiscrete(self.attr_y.name, [val_y])
                    ]))
            else:
                width = 1
            pen = area.pen()
            pen.setWidth(width)
            area.setPen(pen)
        if len(filts) == 1:
            filts = filts[0]
        else:
            filts = filter.Values(filts, conjunction=False)
        selection = filts(self.discrete_data)
        idset = set(selection.ids)
        sel_idx = [i for i, id in enumerate(self.data.ids) if id in idset]
        if self.discrete_data is not self.data:
            selection = self.data[sel_idx]

        self.Outputs.selected_data.send(selection)
        self.Outputs.annotated_data.send(create_annotated_table(self.data, sel_idx))
def update_selection ( self ) : if self . areas is None or not self . selection : self . Outputs . selected_data . send ( None ) self . Outputs . annotated_data . send ( create_annotated_table ( self . data , [ ] ) ) return filts = [ ] for i , area in enumerate ( self . areas ) : if i in self . selection : width = 4 val_x , val_y = area . value_pair filts . append ( filter . Values ( [ filter . FilterDiscrete ( self . attr_x . name , [ val_x ] ) , filter . FilterDiscrete ( self . attr_y . name , [ val_y ] ) ] ) ) else : width = 1 pen = area . pen ( ) pen . setWidth ( width ) area . setPen ( pen ) if len ( filts ) == 1 : filts = filts [ 0 ] else : filts = filter . Values ( filts , conjunction = False ) selection = filts ( self . discrete_data ) idset = set ( selection . ids ) sel_idx = [ i for i , id in enumerate ( self . data . ids ) if id in idset ] if self . discrete_data is not self . data : selection = self . data [ sel_idx ] self . Outputs . selected_data . send ( selection ) self . Outputs . annotated_data . send ( create_annotated_table ( self . data , sel_idx ) )