Is your example table the way the data itself is organized? What's the source table look like? Assuming your table is an accurate representation, here's what it could look like:
// calculating your percentage
var q_complete = $datapoint['questionnaires_completed']
var q_target = $datapoint['target']
var percentage = (q_complete / q_target) * 100
// color based on percentage; replace with whatever hex codes you like
var status_color = Iif(
percentage == 100,
'#ddffdd', // green
'#ffdddd' // red
)
// returning the values
return {
backgroundColor: status_color,
attributes: {
percentage
}
}
Then in your list item template, reference {expression/percentage} to pull in the percentage value.
- Josh Carlson
Kendall County GIS