AnsweredAssumed Answered

Labeling in AGOL with Arcade

Question asked by eleanor.dhuyvetter_noaa on May 3, 2019
Latest reply on May 5, 2019 by xander_bakker

Hello! 

 

I have a quick question about creating colored labels in AGOL with arcade. I am trying to filter out my data with If/else statements for the appropriate range for a given color, then assigning a color to that value in the label with Text formatting tags. The arcade code is below. Any other ideas on how to create this would help as well! 

 

I am new to arcade, so thanks for bearing with me! 

 

## convert number to string 

var temp = Text($feature["tmdb_f"])

 

## partition each range of temperature out first, then assign colored label to that range. 
if ($feature["tmdb_f"] >=90) {


return "<CLR red='139'><FNT size = '14'>" + [temp] + "</FNT></CLR>"
}
else {
return null
}

if ($feature["tmdb_f"] <=80) {
return "<CLR red='255'><FNT size = '14'>" + [temp] + "</FNT></CLR>"
}
else {
return null
}

if ($feature["tmdb_f"] <=70) {
return "<CLR red='255', green= '153', blue='51'><FNT size = '14'>" + [temp] + "</FNT></CLR>"
}
else {
return null
}

if ($feature["tmdb_f"] <=60) {
return "<CLR red='255', green= '215'><FNT size = '14'>" + [temp] + "</FNT></CLR>"
}
else {
return null
}

if ($feature["tmdb_f"] <=50) {
return "<CLR red='50', green= '205', blue='50'><FNT size = '14'>" + [temp] + "</FNT></CLR>"
}
else {
return null
}

if ($feature["tmdb_f"] <=40) {
return "<CLR green= '128'><FNT size = '14'>" + [temp] + "</FNT></CLR>"
}
else {
return null
}

if ($feature["tmdb_f"] <=30) {
return "<CLR green= '255', blue='255'><FNT size = '14'>" + [temp] + "</FNT></CLR>"
}
else {
return null
}

if ($feature["tmdb_f"] <=20) {
return "<CLR green= '128', blue='128'><FNT size = '14'>" + [temp] + "</FNT></CLR>"
}
else {
return null
}

if ($feature["tmdb_f"] <=10) {
return "<CLR blue='139'><FNT size = '14'>" + [temp] + "</FNT></CLR>"
}
else {
return null
}

if ($feature["tmdb_f"] <=0) {
return "<CLR red='148', blue='211'><FNT size = '14'>" + [temp] + "</FNT></CLR>"
}
else {
return null
}

Outcomes