Been banging head against wall trying to sort this out.
The code compares {Last} and one of 6 colums P025 through P975. If {Last} is greater than the column value, it shades the cell green. If {Last} is less than the column value, it shades the cell red. Pretty simple.
It works most of the time. But I get these oddball shadings that happen and I can’t explain it.
Any ideas?
Here’s the code:
style_data_conditional = [
{
'if':{
'filter_query': '{Last} > {P025}',
'column_id': 'P025'
},
'backgroundColor': 'green',
'color': 'black'
},
{
'if':{
'filter_query': '{Last} < {P025}',
'column_id': 'P025'
},
'backgroundColor': 'red',
'color': 'black'
},
{
'if':{
'filter_query': '{Last} > {P10}',
'column_id': 'P10'
},
'backgroundColor': 'green',
'color': 'black'
},
{
'if':{
'filter_query': '{Last} < {P10}',
'column_id': 'P10'
},
'backgroundColor': 'red',
'color': 'black'
},
{
'if':{
'filter_query': '{Last} > {LT}',
'column_id': 'LT'
},
'backgroundColor': 'green',
'color': 'black'
},
{
'if':{
'filter_query': '{Last} < {LT}',
'column_id': 'LT'
},
'backgroundColor': 'red',
'color': 'black'
},
{
'if':{
'filter_query': '{Last} > {UT}',
'column_id': 'UT'
},
'backgroundColor': 'green',
'color': 'black'
},
{
'if':{
'filter_query': '{Last} < {UT}',
'column_id': 'UT'
},
'backgroundColor': 'red',
'color': 'black'
},
{
'if':{
'filter_query': '{Last} > {P90}',
'column_id': 'P90'
},
'backgroundColor': 'green',
'color': 'black'
},
{
'if':{
'filter_query': '{Last} < {P90}',
'column_id': 'P90'
},
'backgroundColor': 'red',
'color': 'black'
},
{
'if':{
'filter_query': '{Last} > {P975}',
'column_id': 'P975'
},
'backgroundColor': 'green',
'color': 'black'
},
{
'if':{
'filter_query': '{Last} < {P975}',
'column_id': 'P975'
},
'backgroundColor': 'red',
'color': 'black'
}],