Webmap legend order: ascending vs. descending

1128
4
Jump to solution
08-05-2021 01:51 PM
JoanneMcGraw
Occasional Contributor III

I am using a classBreaksRenderer to symbolize a layer in a webmap. The Web Map specification suggests I can use legendOptions' "order" property to indicate the legend should display in ascendingValues or descendingValues (see https://developers.arcgis.com/web-map-specification/objects/legendOptions/).

How/Where can I set that property to ascending in a webmap hosted by AGOL? I've looked around in both  the new and the old Viewer but haven't found the UI. Can anyone point me in the right direction?

Appreciated,

jtm

1 Solution

Accepted Solutions
JoanneMcGraw
Occasional Contributor III

Thanks again, Jansen.

I had found that page but was unable to get access to the "New expression" option it suggests should be in the drop down list of fields. Eventually, I realized that the functionality is not available for the service in question because it is being served by a 10.4.1 ArcGIS Server; the functionality was introduced in 10.5.1.

So, after some thought, I've decided that I am principally concerned with how the legend appears in an HTML page where the Web Map is displayed using a copy of the minimalist template we have deployed on our server. I am less concerned with how the legend appears in AGOL's viewers...if they're okay with their legends displaying in that order, then so am I...in their viewers 😉

I'm now looking into setting the legendOptions' "order" property to "ascendingValues" after the WebMap has loaded in my HTML pages. So, not really a solution, per se, because my question was how to change the order in the AGOL viewers but perhaps the post will provide some info to others anyway.

Thanks again, Jansen! If anyone is able to try his suggestion, let me know if it works for reordering a layer's legend items to display in ascending order and I'll add his entry as a solution also.

Joanne

View solution in original post

4 Replies
GIS_Fox
Occasional Contributor III

Hi @JoanneMcGraw , you could do this in the webmap under the content tab and rearrange order the items are shown there. If this is a specific layer like you are describing there may be a way to do it in Arcade, although I am not well versed enough to note where or how to do this specifically without affecting the layer's symbology itself rather than just the legend.

Hopefully this helps some, 

 

Jansen Lyons - Records and GIS Section - Public Works - City of Rio Rancho, NM
0 Kudos
JoanneMcGraw
Occasional Contributor III

Thank you for taking the time to respond, Jansen.

In my particular scenario, the Web Map contains only the default basemap and a single ArcGIS Server MapService, so I don't believe the Content rearranging possibility applies. I would like to display the legend for that web service layer in ascending order, rather than (what appears to be the default) descending order. That is, the symbology classes are displaying in the legend, by default, as:

  • 8 - 10
  • 5 - 8
  • 1 - 5

Rather than:

  • 1 - 5
  • 5 - 8
  • 8 - 10

Your Arcade suggestion may work but I don't know enough about that functionality to know how to go about it. I'll look into it though and report back if I find anything. Thanks for the suggestion!

Cheers,

Joanne

GIS_Fox
Occasional Contributor III

Hi @JoanneMcGraw ,

Here we go, I knew I had it somewhere. I've recommended this before and used it myself, hopefully this article will be of use to you as it has for me. I'm not nearly as versed in Arcade as I would like but this covers the basics of your area of interest.

https://www.arcgis.com/apps/Cascade/index.html?appid=3271f9b87c394c07b4a871257a5dc46b 

God bless,

 

Jansen Lyons - Records and GIS Section - Public Works - City of Rio Rancho, NM
0 Kudos
JoanneMcGraw
Occasional Contributor III

Thanks again, Jansen.

I had found that page but was unable to get access to the "New expression" option it suggests should be in the drop down list of fields. Eventually, I realized that the functionality is not available for the service in question because it is being served by a 10.4.1 ArcGIS Server; the functionality was introduced in 10.5.1.

So, after some thought, I've decided that I am principally concerned with how the legend appears in an HTML page where the Web Map is displayed using a copy of the minimalist template we have deployed on our server. I am less concerned with how the legend appears in AGOL's viewers...if they're okay with their legends displaying in that order, then so am I...in their viewers 😉

I'm now looking into setting the legendOptions' "order" property to "ascendingValues" after the WebMap has loaded in my HTML pages. So, not really a solution, per se, because my question was how to change the order in the AGOL viewers but perhaps the post will provide some info to others anyway.

Thanks again, Jansen! If anyone is able to try his suggestion, let me know if it works for reordering a layer's legend items to display in ascending order and I'll add his entry as a solution also.

Joanne