color code list using arcade

1372
4
Jump to solution
01-18-2022 08:42 AM
JoeLivoti
New Contributor III

If someone could please help me with the code and how to implement it. I have a list with status field in it. I would like to color code the status based on choice that was made.

the field name is status

the options are - submitted (color to be red), received (orange), inprogress (yellow), resolved (green) 

i believe i need to go to the list and advanced formatting, but that's all i know at this point.

any help would be greatly appreciated!!!

Thank you

Tags (2)
0 Kudos
1 Solution

Accepted Solutions
jcarlson
MVP Esteemed Contributor

Simple enough, you just need a quick decode to convert your statuses into colors.

var bg = Decode($datapoint.status,
'submitted', 'red',
'received', 'orange',
'inprogress', 'yellow',
'resolved', 'green',
'')


return {
  backgroundColor: bg
}

 

- Josh Carlson
Kendall County GIS

View solution in original post

4 Replies
jcarlson
MVP Esteemed Contributor

Simple enough, you just need a quick decode to convert your statuses into colors.

var bg = Decode($datapoint.status,
'submitted', 'red',
'received', 'orange',
'inprogress', 'yellow',
'resolved', 'green',
'')


return {
  backgroundColor: bg
}

 

- Josh Carlson
Kendall County GIS
JoeLivoti
New Contributor III

 where in the code do i put that (please forgive me i'm pretty new to arcade in the dashboards)... as i've done in the picture??

0 Kudos
jcarlson
MVP Esteemed Contributor

You can see in my expression that I actually gave you the return statement, too. If all you want to change is the background color, you don't need anything else.

- Josh Carlson
Kendall County GIS
0 Kudos
JoeLivoti
New Contributor III

Gotcha!!!! that works too... i was just looking to change the word color, but this is more dynamic!!! thank you very much!!!

0 Kudos