FeatureReduction Clustering in 4.19: Change color of cluster based on number of features in cluster

1437
4
04-27-2021 06:39 AM
Jay_Gregory
Occasional Contributor III

Curious if it's possible to adjust the color of the point cluster symbol based on the number of features it contains.  Certainly size is important (and the default), but I have found that users are also more easily drawn to colors than size (esp when the screen is covered with many different size circles).  The examples show how to adjust the colors based on average attribute values using visual variables, but unclear if this is possible just referencing the cluster count. 

0 Kudos
4 Replies
ReneRubalcava
Frequent Contributor

Clustered features have a field called "cluster_count" that you can use for visualizations.

https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-FeatureReductionCl...

This sample colors clusters based on a TEMP field, but you could change it to "cluster_count" to do it by count. Same for other types of visualizations.

0 Kudos
ReneRubalcava
Frequent Contributor

Ok, so slight correction here. This isn't technically supported for visualization, as "cluster_count" is really used for labels and popups, but try this out and we'd love feedback on how well it works or any issues you might find with it. There is an existing idea to provide an API for rendering clusters, so feedback would be welcome there too. We're currently looking at how to best support this in the future.

Jay_Gregory
Occasional Contributor III

Right, I was just about to say that it seems that the feature layer renderer doesn't have access to the cluster_count variable - only the popup.  When I tried just replacing the visual variable field in the example you sent with cluster_count, nothing happened (i.e. no symbol was rendered, just the label).  The symbol property of the cluster config does allow to change the style of the cluster symbol, but still can't really assign a class breaks renderer to the cluster symbols.  The feature would be very useful in the future.  There was a plugin for the 3.x api I use to cluster features (see screenshot).  Not having this kind of control isn't a deal-breaker in refactoring to 4.x, but it would certainly be helpful.  

0 Kudos
ShariMeier
New Contributor II

I just stumbled across the same problem. I wanted to adjust the cluster's color according to the color of the youngest object inside the cluster. But without success...

This feature would be very interesting for us as well. @ReneRubalcava  Is there any plan to support this technically for visualization in a newer release?

0 Kudos