Skip to content

Commit df6a2ae

Browse files
committed
Simplified README.MD
1 parent 03289bd commit df6a2ae

1 file changed

Lines changed: 4 additions & 27 deletions

File tree

  • maps-sdk/javascript-maps-sdk/remove-cluster-info-from-legend

maps-sdk/javascript-maps-sdk/remove-cluster-info-from-legend/README.MD

Lines changed: 4 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -12,25 +12,7 @@ Main logic of the code is located inside index.html. unique-value-symbol-config.
1212

1313
## How It Works
1414

15-
1. Create a function that hides cluster information
16-
17-
```javascript
18-
function hideClusterInformation() {
19-
// Add code here
20-
21-
}
22-
```
23-
24-
2. Inside the function, first clone the layer's featureReduction object
25-
26-
```javascript
27-
function hideClusterInformation() {
28-
const featureReductionTemplate = layer.featureReduction.clone();
29-
30-
}
31-
```
32-
33-
3. Add the same renderer, but include a new visualVariables property. Set showLegend to false inside the legendOptions property
15+
1. Create a function that hides cluster information. This is achieved by overriding visualVariables and setting showLegend to false
3416

3517
```javascript
3618
function hideClusterInformation() {
@@ -53,24 +35,19 @@ function hideClusterInformation() {
5335
}]
5436
}
5537

38+
layer.featureReduction = featureReductionTemplate;
5639
}
5740
```
5841

59-
4. Replace the original layer's featureReduction property
60-
61-
```javascript
62-
layer.featureReduction = featureReductionTemplate;
63-
```
64-
65-
5. Wait for layer to finish loading before calling the hideClusterInformation() function
42+
2. Wait for layer to finish loading before calling the hideClusterInformation() function
6643

6744
```javascript
6845
mapElement.whenLayerView(layer).then(() => {
6946
hideClusterInformation();
7047
});
7148
```
7249

73-
6. 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.
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.
7451

7552
```javascript
7653
toggleButton.addEventListener("click", () => {

0 commit comments

Comments
 (0)