Select to view content in your preferred language

Legend Values for Unclassed Symbology

1154
8
Jump to solution
09-01-2023 12:03 PM
JohnMax
New Contributor III

I have a polygon layer with unclassed colors symbology that is showing a range of values in the legend from -9223372036854776000 - 9223372036854776000.  How can I hide or change this in the legend?  I only really want to show the color ramp or the actual data range of -99 to 17,200.  Thanks.

Legend.JPG

0 Kudos
1 Solution

Accepted Solutions
Sage_Wall
Esri Contributor

Thanks @JohnMax .  It looks like you are using the renderer as it was defined when publishing the service. Likely the easiest and most permanent way would be to modify the symbology for the layer in the original ArcGIS Pro project and republish the service. If that's not possible you can set your own renderer for the layer in the app code.  In this codepen I set two stops one at -99 and the other at 17,200 and set the label to "Parcel" for a simple renderer with a color visual variable.

https://codepen.io/sagewall/pen/jOXVyNN

 

Another sample showing basically the same thing:

https://developers.arcgis.com/javascript/latest/sample-code/visualization-vv-color/

 

Hope this helps 😀

View solution in original post

8 Replies
SarahRijneke
Occasional Contributor

Have you built pyramids and calculated statistics? I believe that should properly display your values.

0 Kudos
JohnMax
New Contributor III

This is actually a polygon layer which is symbolized as unclassed colors.

0 Kudos
Sage_Wall
Esri Contributor

Hi @JohnMax. Could you please share a Codepen, StackBlitz or GitHub repo demonstrating how you created the renderer on the layer.

0 Kudos
JohnMax
New Contributor III

Here is some sample code:

<html lang="en">
<head>
<meta charset="utf-8" />
<meta
name="viewport"
content="initial-scale=1,maximum-scale=1,user-scalable=no"
/>
<title>
ArcGIS Maps SDK for JavaScript 4.27
</title>

<link
rel="stylesheet"
href="https://js.arcgis.com/4.27/esri/themes/light/main.css"
/>
<script src="https://js.arcgis.com/4.27/"></script>

<style>
html,
body,
#viewDiv {
padding: 0;
margin: 0;
height: 100%;
width: 100%;
}
</style>

<script>
require(["esri/Map", "esri/views/MapView", "esri/layers/FeatureLayer","esri/widgets/Legend"], (
Map,
MapView,
FeatureLayer,
Legend
) => {
const map = new Map({
basemap: "hybrid"
});

const view = new MapView({
container: "viewDiv",
map: map,

center: [-113.58332, 37.10819], // lon, lat
zoom: 16,
});

/********************
* Add feature layer
********************/
const featureLayer = new FeatureLayer({
url: "https://agisprodvm.washco.utah.gov/arcgis/rest/services/Assessor/MapServer/14"
});

map.add(featureLayer);

const legend = new Legend({
view: view,
layerInfos: [
{
layer: featureLayer
}
]
});

// Add widget to the bottom right corner of the view
view.ui.add(legend, "bottom-right");
});
</script>
</head>

<body>
<div id="viewDiv"></div>
</body>
</html>

0 Kudos
Sage_Wall
Esri Contributor

Thanks @JohnMax .  It looks like you are using the renderer as it was defined when publishing the service. Likely the easiest and most permanent way would be to modify the symbology for the layer in the original ArcGIS Pro project and republish the service. If that's not possible you can set your own renderer for the layer in the app code.  In this codepen I set two stops one at -99 and the other at 17,200 and set the label to "Parcel" for a simple renderer with a color visual variable.

https://codepen.io/sagewall/pen/jOXVyNN

 

Another sample showing basically the same thing:

https://developers.arcgis.com/javascript/latest/sample-code/visualization-vv-color/

 

Hope this helps 😀

JohnMax
New Contributor III

Thank you!!  There was no way I could see to change the symbology of the service that would change the values in the legend.  This is exactly what I needed. 🙂

Joe1
by
New Contributor

I am having the same exact issue however I don't have an understanding of the coding side of GIS. Could I get a step-by-step instruction on how to fix the problem. 

I am using unclassed colors to symbolize a set of polygons by a range of numerical values and for some reason in my webmap legend I am getting an output of those numbers (-9223372036854776000 - 9223372036854776000)

0 Kudos
JohnMax
New Contributor III

I'm no expert, but this sample code helped me a lot.

https://developers.arcgis.com/javascript/latest/sample-code/sandbox/?sample=visualization-vv-color

In the sample you define the symbology in a constant called renderer.  Then you add the it to the feature layer using renderer: renderer.  In this way you can control the legend text using the label: properties in the code.       

 

0 Kudos