HOW TO
In ArcGIS Online Map Viewer, Arcade expressions can be used to display the top field values in a pop-up pie chart. This article provides an example and instructions using Arcade expressions to create a Map Viewer pop-up pie chart displaying the top three languages spoken at home in Caledon, Ontario, Canada.
Note: The following procedure (Steps 3b through 6) must be completed three times. One for each position of the top three values.
var <variableName1> = [ $feature.<fieldName1>, $feature.<fieldName2>, ... $feature.<fieldName214> ];
return Reverse(Sort(<variableName1>))[0]
return Reverse(Sort(<variableName1>))[1]
return Reverse(Sort(<variableName1>))[2]
var lang_arr = [ $feature.MO_English, $feature.MO_French, $feature.MO_Hindi, $feature.MO_Hungarian, $feature.MO_Icelandic, $feature.MO_Japanese, $feature.MO_Korean, $feature.MO_Krio, $feature.MO_Ktunaxa_Kutenai, $feature.MO_Malay, $feature.MO_Malayalam, $feature.MO_Mandarin, $feature.MO_Mwani, $feature.MO_Naskapi, $feature.MO_Norwegian, $feature.MO_Oneida, $feature.MO_Oromo, $feature.MO_Polish, $feature.MO_Punjabi_Panjabi, $feature.MO_Romanian, $feature.MO_Rundi_Kirundi, $feature.MO_Russian, $feature.MO_Serbian, $feature.MO_Serbo_Croatian, $feature.MO_Sindhi, $feature.MO_Spanish, $feature.MO_Swedish, $feature.MO_Tagalog_Pilipino_Filipino, $feature.MO_Tamil, $feature.MO_Turkish, $feature.MO_Ukrainian, $feature.MO_Urdu, $feature.MO_Vietnamese, $feature.MO_Wu_Shanghainese, $feature.MO_Yiddish, $feature.MO_Yoruba, $feature.MO_Yue_Cantonese ]; return Reverse(Sort(lang_arr))[0]
Note: To reference the field names related to the field values displayed in the pop-up, create a legend. Refer to How To: Create an ArcGIS Online Map Viewer pop-up pie chart legend displaying the top values for instructions.
The newly configured pop-up pie chart below shows the top three languages spoken at home in Caledon, Ontario, Canada.
Get help from ArcGIS experts
Download the Esri Support App