Conditionally format dashboard indicator color based on selection

310
0
10-19-2022 11:35 AM
Labels (1)
ehuisman
New Contributor

I am trying to conditionally format the text color of an indicator in a dashboard based on the selected slice of a pie chart. The indicator shows the sum of features and when a slice of the pie chart is selected, the indicator is filtered to only show the sum of features in that year. I have been able to make the color conditional on the count of features, but have been unable to make the color dependent on the selected year. My current code is below:

var c = $datapoint["count_x"]
var color = When(
    c == 1 ,'#A7C636',
    c == 3 ,'#149ECE', '#000000')

return {
    middleText: $datapoint["count_x"],
    middleTextColor: color,
    middleTextOutlineColor: '',
    middleTextMaxSize: 'large',
  }

 

My biggest issue is being unable to reference the feature itself, rather than the count of features. Attribute X is the year that I would like to sort by.

0 Kudos
0 Replies