You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This sample shows how to remove clustering information from the Legend. This sample is a modification of [this sample](https://developers.arcgis.com/javascript/latest/sample-code/featurereduction-cluster/). Other minor modifications include:
6
+
7
+
- Implementation of [Map components](https://developers.arcgis.com/javascript/latest/references/map-components/)
8
+
-[Module loading via CDN](https://developers.arcgis.com/javascript/latest/get-started-cdn/#module-loading-via-cdn)
9
+
- Replacing the SimpleRenderer with [ClassBreaksRenderers](https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-ClassBreaksRenderer.html)
10
+
11
+
Main logic of the code is located inside index.html. unique-value-symbol-config.js contains symbology and renderer information for the layer.
12
+
13
+
## How It Works
14
+
15
+
1. Create a function that hides cluster information. This is achieved by overriding visualVariables and setting showLegend to false
classBreakInfos: classBreakInfos, // classBreakInfos obtained from unique-value-symbol-config.js
25
+
visualVariables: [{
26
+
type:"size",
27
+
field:"cluster_count",
28
+
legendOptions: {
29
+
showLegend:false
30
+
},
31
+
minDataValue:2,
32
+
maxDataValue:400,
33
+
minSize:18,
34
+
maxSize:54
35
+
}]
36
+
}
37
+
38
+
layer.featureReduction= featureReductionTemplate;
39
+
}
40
+
```
41
+
42
+
2. Wait for layer to finish loading before calling the hideClusterInformation() function
43
+
44
+
```javascript
45
+
mapElement.whenLayerView(layer).then(() => {
46
+
hideClusterInformation();
47
+
});
48
+
```
49
+
50
+
3. Add the same function to the toggle button functionality. It is important that you set the layer.featureReduction to clusterConfig before calling the hideClusterInformation() function.
0 commit comments