At the bottom of the docs, https://docs.inductiveautomation.com/docs/8.1/appendix/components/perspective-components/perspective-chart-palette/perspective-pie-chart#example,
Value types can vary as you can pass both "50" and 50 as counts and the Pie Chart will still be able to render the data correctly.
...
The query used must return two columns in any order where each column represents a string and a numeric value to be rendered by the chart.
The Pie Chart is trying to be smart. It sees that both label
and value
are numeric so it gets confused and doesn't know which is the label. Try this:
def transform(self, value, quality, timestamp):
pieData = []
for row in value:
pieData.append({
"label": "RIESGO " + str(row['RIESGO'])),
"value": row['TOTAL']
})
return pieData