The onSelection parameter is storing the row and column id of the selected dataset in chart. You can try the below code to understand the behaviour of the attribute. Since its a pie chart thus column is always null. Hope it helps!
a!localVariables(
local!data: {
{ Tasks: "Work", Hours: 11 },
{ Tasks: "Eat", Hours: 2 },
{ Tasks: "Commute", Hours: 2 },
{ Tasks: "Sleep", Hours: 7 },
{ Tasks: "Hobbies", Hours: 2 }
},
googlePieChartField(
label: "Test",
chartColumnData: {
{
type: "string",
id: "Tasks",
rowDataKey: "Tasks"
},
{
type: "number",
id: "Hours",
rowDataKey: "Hours"
}
},
chartRowData: { local!data },
onSelection: {
a!save(
ri!var,
index(local!data, save!value.row, {})/*save!value*/
),
}
)
)