ArcGIS dashboard indicator formatting with colors

599
2
07-13-2022 11:47 AM
Labels (2)
GeorgeJones9282
New Contributor II

Hi all, 

I'm formatting an indicator dashboard element. I'm trying to make the first word white and the value(datapoint["count"]) yellow which reflects the data sum of the feature class. Any feedback would be helpful! 

Here is what I tried so far but doesn't do what I want.

var count = $datapoint["count"];
var color = IIF(count == $datapoint["count"])  {

       return topColor: '#FFFF00' ,

} else {

    return topColor: '#FFFFFF', 

};

 

return {
//textColor:'',
backgroundColor:'#000000',
topText:'Open Projects:' + '' + data,

//attributes: {
// attribute1: '',
// attribute2: ''
// }

topTextColor: color,
topTextOutlineColor: '',
topTextMaxSize: 'medium',
middleText: 'Month: July',
middleTextColor: '#FFFF00',
middleTextOutlineColor: '#FFFF00',
middleTextMaxSize: 'small',

//bottomTextOutlineColor: '',
//bottomTextMaxSize: 'medium',
//iconName:'',
//iconAlign:'left',
//iconColor:'',
//iconOutlineColor:'',
//noValue:false,

}

 

0 Kudos
2 Replies
jcarlson
MVP Esteemed Contributor

How is your indicator configured? It's showing a sum? If you're aggregating the data in your indicator, the count of the records won't be directly accessible in the $datapoint.

You may be able to do this with a reference value. Your reference value can be the count, the value can be the sum.

jcarlson_0-1657762829671.png

Then in your Arcade, you can reference the $reference value.

In regards to your Arcade itself, the Iif function is not followed by curly brackets. It follows the format Iif(condition, return_if_true, return_if_false).

Also, in your conditions, you are using the keyword return. When your expression encounters a return, it stops and returns whatever value follows that keyword, so only do that if you're at the "end" of your expression.

I'd love to give you a sample expression, but I'd need to know a bit more about how your indicator is configured, and possibly details about the data itself. Any chance the layer is public?

- Josh Carlson
Kendall County GIS
GeorgeJones9282
New Contributor II

Hey Josh, this data  is private within the Army National Guard org but I think you gave me enough to steer me in the right direction. Data is the total count of the construction projects across the state. However, in one of the examples I looked at here worked:

var color =  IIF($datapoint.Velocity == 0, '#F3DED7', '') 

 

In the below code, I couldn't pass the color property into the variable and thus the text value was still white afterwards.

var data = IIF($reference.count == 109, '#e6e600', '');

return {
//textColor:'',
backgroundColor:'#000000',
topText:'Open Projects:' + ' ' + data,

//attributes: {
// attribute1: '',
// attribute2: ''
// }

topTextColor: '#FFFFFF',
topTextOutlineColor: '',
topTextMaxSize: 'medium',
middleText: 'Month: July',
middleTextColor: '#FFFF00',
middleTextOutlineColor: '#FFFF00',
middleTextMaxSize: 'small',

//bottomTextOutlineColor: '',
//bottomTextMaxSize: 'medium',
//iconName:'',
//iconAlign:'left',
//iconColor:'',
//iconOutlineColor:'',
//noValue:false,

}

 

 

 

 

Thank you for your time!- George

0 Kudos