Converting table row data into a graph

Hello!

I would like to show a graph in a Power Chart when I click on a row from a table.

Something like:

what I got now is a onRowClick event like:
image

def runAction(self, event):
    if self.props.data is None or self.props.data.getRowCount() == 0 or self.props.selection.selectedRow == -1:
        self.getSibling("chartDistri").props.data = []
    else:

     
        selectedRow = self.props.selection.selectedRow
        
     
        myDataset = self.props.data
        
        # Use column indices
        selectedRowData = {
            'column5': myDataset.getValueAt(selectedRow, 5),
            'column6': myDataset.getValueAt(selectedRow, 6),
            'column7': myDataset.getValueAt(selectedRow, 7),
            'column8': myDataset.getValueAt(selectedRow, 8),
            'column9': myDataset.getValueAt(selectedRow, 9),
        }
        
   
        self.getSibling("chartDistri").props.data = [selectedRowData]
        

nothing shows on the PowerChart.

Am I using the right components? Am I using the right click event?

The power chart only works with Historical Tag data, and populates using its own queries in the background based on the provided historical tag pens.

You can not provide your own dataset to this component.

You should be using either an XY Chart or a time series chart (or other third party supplied chart type if applicable).

1 Like

Thanks Irose, will try!

You can also use the Table component's subview to display the chart. It will expand under the selected row. This will make it easier to relate the numbers with the chart.

2 Likes

That sounds like a great solution Transistor, I will find how to do this.

1 Like