Color of Cluster

832
1
09-14-2021 02:33 AM
NewUser222
New Contributor

Hi,
I have a feature layer with multiple fields (using unique-value renderer) of 4 different colours. I have applied clustering to it.
My first question is how is the colour of a cluster decided? Does it depend on the colour of the point that is occurring the most in that cluster?

And secondly, is there a way to give precedence to a particular field so that if the cluster has that particular field, it would take its colour.

I might not have articulated my question well, please excuse me for that.

 

0 Kudos
1 Reply
KristianEkenes
Esri Regular Contributor

> My first question is how is the colour of a cluster decided?

The color of a cluster is determined based on the style of the layer. If it is a unique value style, the color of the most common type within the cluster is used to shade the entire cluster. If a class breaks or continuous color visualization is used, then it is the color of the average value of features in that cluster. This behavior is described in the "Styles and configurations" part of the FeatureReductionCluster API reference: https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-FeatureReductionCl...

Be sure to expand the "Read more" area to read the details:

KristianEkenes_0-1633042010972.png

 

is there a way to give precedence to a particular field so that if the cluster has that particular field, it would take its colour.

There isn't a great way to do this yet. We're evaluating providing an API for styling cluster features in a future release (not yet decided). 

 

However, you can achieve this using Arcade and by changing the style of the base layer. You would need to specify an Arcade expression on the layer's renderer then set up two class breaks: one to symbolize clusters that have no features of the desired type and another that has at lease one. Here's an example: 

https://codepen.io/kekenes/pen/WNOmYjQ?editors=100

 

In this app I color the clusters yellow if it contains at least one "ice quake". I can also provide the number of ice quakes in the popup. Hope that helps.

0 Kudos