dhoefener
Posts: 2
Joined: Thu Jul 15, 2021 7:36 pm

Color clusters based on data contained within

Hi,
I'm looking to recolor the clusters on a map based on an average of values from the points contained within the cluster. I've gotten as far as being able to access the cluster the data, from the tooltip formatter for example, but where I'm stuck is how I can create a function to then update the color of the color based on the data.

Is this possible?

Thanks in advance
dominik.c
Posts: 2081
Joined: Fri Aug 07, 2020 7:07 am

Re: Color clusters based on data contained within

Hello dhoefener!

Welcome to our forum and thanks for contacting us with your question!

Unfortunately, it's not so easy. There's a ticket on GitHub where the issue is well explained.

I suggest getting familiar with it: https://github.com/highcharts/highcharts/issues/14017

Workaround to change the cluster color (from the GH ticket): https://jsfiddle.net/BlackLabel/j6mbr71u/

Best regards!
Dominik Chudy
Highcharts Developer
dhoefener
Posts: 2
Joined: Thu Jul 15, 2021 7:36 pm

Re: Color clusters based on data contained within

Hi Dominik,
Thanks for the reference. I understand it's stated this is not possible in the post you directed me to and is a feature that will not be implemented, but I was able to change the color of the cluster points based on the underlying data by adding some calculations to the chart render event: https://jsfiddle.net/8m5b9czf/25

However, the cluster point colors are not updated until mouse over on the cluster point. Is it possible to modify this so that the clusters' colors are updated when the chart is rendered?

Thanks,
Dillon
dominik.c
Posts: 2081
Joined: Fri Aug 07, 2020 7:07 am

Re: Color clusters based on data contained within

Hi again!

Yes, we can set the state of these points to hover before they get rendered like that: https://jsfiddle.net/BlackLabel/w4d5q13j/

API references: https://api.highcharts.com/class-refere ... t#setState

Best regards!
Dominik Chudy
Highcharts Developer

Return to “Highcharts Maps”