maps-plus icon indicating copy to clipboard operation
maps-plus copied to clipboard

Change cluster color based on color of marker

Open ghost opened this issue 4 years ago • 3 comments

Hey! I was not able to change color of clusters based on the markercolor. For example, cluster color can change based on how many markers are inside. But is it possible to change the color based on the markercolor or iconcolor inside? so if markercolor is red and green inside one cluster - it shows up blue while if markercolor is only red, it shows up red.

Thankyou

ghost avatar Jul 14 '22 20:07 ghost

I have requested to make cluster color dependent on clusterGroup

https://github.com/sghaskell/maps-plus/issues/39

lorenzoalbanof avatar Jan 25 '23 13:01 lorenzoalbanof

Thanks for the request! To clarify the distinction: v4.6.0 added clusterBgColor and clusterFgColor SPL fields that let you explicitly assign cluster colors per group. What you’re describing here is different — automatic cluster color derivation based on the markerColor of the markers inside the cluster (e.g., an all-red cluster shows red, a mixed cluster shows a neutral color). That’s a distinct and interesting enhancement we’d like to explore in a future release.

sghaskell avatar Mar 26 '26 06:03 sghaskell

Thanks for the request. This is a good use case and we plan to add it in a future release. Here's where things stand:

Partial workaround available today: The clusterGroup + clusterGroupColors fields already handle the homogeneous case. If you segment your markers by color/severity into named cluster groups, each group gets its own colored cluster bubble:

| eval clusterGroup=case(severity="critical", "critical", severity="warning", "warning", 1=1, "ok")

Then in the viz format options:

clusterGroupColors = critical:red, warning:orange, ok:green

Each cluster group clusters independently with its own color. This covers most status-dashboard use cases where markers can be pre-segmented by color in SPL.

What's not yet supported: Dynamic cluster color derived from the actual child marker colors at render time — i.e., a cluster that contains both red and green markers automatically showing a "mixed" or dominant color. That requires runtime inspection of child markers inside iconCreateFunction and a defined rule for mixed-color clusters (e.g., highest severity wins).

We're tracking this for a future release. The design question of how to handle mixed-color clusters (dominant color? fixed "mixed" indicator?) will need to be settled before implementing. Leaving this open.

sghaskell avatar Mar 27 '26 06:03 sghaskell