Select to view content in your preferred language

show sum in cluster label

1109
3
Jump to solution
08-10-2021 03:51 PM
forestknutsen1
MVP Regular Contributor

How do I get the sum not the average in my cluster label? 

forestknutsen1_0-1628635767970.png

 

1 Solution

Accepted Solutions
forestknutsen1
MVP Regular Contributor

I found one way to do it (line 3)... but if feels like it is not the best. I feel like I should be able to get the sum directly:

  $feature["cluster_avg_CUSTOMERS_AFFECTED"];
  var no_feature = $feature["cluster_count"];
  var value = $feature["cluster_avg_CUSTOMERS_AFFECTED"] * no_feature;
  var num = Count(Text(Round(value)));
  var label = When(
    num < 4, Text(value, "#.#"),
    num == 4, Text(value / Pow(10, 3), "#.0k"),
    num <= 6, Text(value / Pow(10, 3), "#k"),
    num == 7, Text(value / Pow(10, 6), "#.0m"),
    num > 7, Text(value / Pow(10, 6), "#m"),
    Text(value, "#,###")
  );
  return label;
  

 

View solution in original post

0 Kudos
3 Replies
forestknutsen1
MVP Regular Contributor

I found one way to do it (line 3)... but if feels like it is not the best. I feel like I should be able to get the sum directly:

  $feature["cluster_avg_CUSTOMERS_AFFECTED"];
  var no_feature = $feature["cluster_count"];
  var value = $feature["cluster_avg_CUSTOMERS_AFFECTED"] * no_feature;
  var num = Count(Text(Round(value)));
  var label = When(
    num < 4, Text(value, "#.#"),
    num == 4, Text(value / Pow(10, 3), "#.0k"),
    num <= 6, Text(value / Pow(10, 3), "#k"),
    num == 7, Text(value / Pow(10, 6), "#.0m"),
    num > 7, Text(value / Pow(10, 6), "#m"),
    Text(value, "#,###")
  );
  return label;
  

 

0 Kudos
KristianEkenes
Esri Regular Contributor

Yep. That is one way to work around the issue for now. The problem with this, however is the size of the cluster doesn't adjust to use the sum. It still uses the average, which can lead to some really small sized clusters with larger numbers than clusters with a larger size.

 

This is something we should support. Still working on some details to help it fit with the existing API smoothly. No timeline at the moment.

 

forestknutsen1
MVP Regular Contributor

Thanks for the feedback Kristian. Yes, the sizing issue is likely a deal breaker for me. I may not be able to use clustering at all until esri improves things.

0 Kudos