Hello!
I´m trying to populate a Pie Chart from the data of a column
I´m getting htis error
but the data is arriving well
the code I´m using is something like:
def runAction(self, event):
# Retrieve the query results from the table component or any other source
tab_container = self.parent.getChild("TabContainer") if self.parent.getChild("TabContainer") else None
if tab_container:
table_component = tab_container.getChild("TablaInventario")
table_data = table_component.props.data if table_component else None
if table_data and table_data.getRowCount() > 0:
nivel_data = {}
# Iterate through the rows to count occurrences of 'Nivel'
for row in range(table_data.getRowCount()):
nivel = table_data.getValueAt(row, "Nivel")
# Count occurrences of each 'Nivel'
if nivel in nivel_data:
nivel_data[nivel] += 1
else:
nivel_data[nivel] = 1
# Format the pie chart data with 'count' and 'flavor'
pie_chart_nivel_data = [{"count": v, "flavor": str(k)} for k, v in nivel_data.items()]
pie_chart_nivel = tab_container.getChild("ColumnContainer_0").getChild("PieChart_Nivel")
if pie_chart_nivel:
pie_chart_nivel.props.data = pie_chart_nivel_data
else:
print("PieChart_Nivel not found.")
else:
print("No data available in the table to update the pie chart.")
else:
print("TabContainer not found.")
Any ideas why this could happening welcome