I am using Advanced formatting in ArcGIS Dashboard, however, the data I am trying to display is not displaying in the correct color. Anything over 4 is yellow. How do I create status colors correctly for a range of values in advanced formatting?
var green = '#2e8540'
var yellow = '#fdb81e'
var red = '#981b1e'
if($datapoint["wave_height"] < 4) {
return {
textColor:'#ffffff',
backgroundColor: green,
topText: 'Wave Height',
topTextColor: '',
topTextOutlineColor: '',
topTextMaxSize: 'medium',
middleText: Text($datapoint["wave_height"], '#.# ft'),
middleTextColor: '',
middleTextOutlineColor: '',
middleTextMaxSize: 'medium',
//bottomText: '',
//bottomTextColor: '',
//bottomTextOutlineColor: '',
//bottomTextMaxSize: 'medium',
iconName:'icon1',
iconAlign:'left',
iconColor:'#ffffff',
iconOutlineColor:''
//noValue:false,
//attributes: {
// attribute1: '',
// attribute2: ''
// }
}
}
else if($datapoint["wave_height"] >= 4) {
return {
textColor:'#ffffff',
backgroundColor: yellow,
topText: 'Wave Height',
topTextColor: '',
topTextOutlineColor: '',
topTextMaxSize: 'medium',
middleText: Text($datapoint["wave_height"], '#.# ft'),
middleTextColor: '',
middleTextOutlineColor: '',
middleTextMaxSize: 'medium',
//bottomText: '',
//bottomTextColor: '',
//bottomTextOutlineColor: '',
//bottomTextMaxSize: 'medium',
iconName:'icon1',
iconAlign:'left',
iconColor:'#ffffff',
iconOutlineColor:''
//noValue:false,
//attributes: {
// attribute1: '',
// attribute2: ''
// }
}
}
else if($datapoint["wave_height"] < 6) {
return {
textColor:'#ffffff',
backgroundColor: yellow,
topText: 'Wave Height',
topTextColor: '',
topTextOutlineColor: '',
topTextMaxSize: 'medium',
middleText: Text($datapoint["wave_height"], '#.# ft'),
middleTextColor: '',
middleTextOutlineColor: '',
middleTextMaxSize: 'medium',
//bottomText: '',
//bottomTextColor: '',
//bottomTextOutlineColor: '',
//bottomTextMaxSize: 'medium',
iconName:'icon1',
iconAlign:'left',
iconColor:'#ffffff',
iconOutlineColor:''
//noValue:false,
//attributes: {
// attribute1: '',
// attribute2: ''
// }
}
}
else if($datapoint["wave_height"] >= 6) {
return {
textColor:'#ffffff',
backgroundColor: red,
topText: 'Wave Height',
topTextColor: '',
topTextOutlineColor: '',
topTextMaxSize: 'medium',
middleText: Text($datapoint["wave_height"], '#.# ft'),
middleTextColor: '',
middleTextOutlineColor: '',
middleTextMaxSize: 'medium',
//bottomText: '',
//bottomTextColor: '',
//bottomTextOutlineColor: '',
//bottomTextMaxSize: 'medium',
iconName:'icon1',
iconAlign:'left',
iconColor:'#ffffff',
iconOutlineColor:''
//noValue:false,
//attributes: {
// attribute1: '',
// attribute2: ''
// }
}
}
else if($datapoint["wave_height"] == 100) {
return {
textColor:'#ffffff',
backgroundColor: red,
topText: 'Wave Height',
topTextColor: '',
topTextOutlineColor: '',
topTextMaxSize: 'medium',
middleText: 'No data',
middleTextColor: '',
middleTextOutlineColor: '',
middleTextMaxSize: 'medium',
//bottomText: '',
//bottomTextColor: '',
//bottomTextOutlineColor: '',
//bottomTextMaxSize: 'medium',
iconName:'icon1',
iconAlign:'left',
iconColor:'#ffffff',
iconOutlineColor:''
//noValue:false,
//attributes: {
// attribute1: '',
// attribute2: ''
// }
}
}