I need to render the background color of a cell based on the value in the cell. The value is retrieved from the a map generated by the controller. The background color will be one of seven colors based on the value retrieved. I have a method written that sets the value of the color as a string and takes the value of the rendered double as an arguement.
It's returning an error "Unknown property 'heatMapController.color'. I figured out from other posts in the forum about this error that the system is looking at the statement:
style="{!color(defendNTAPNum[o.id])}"
as a function instead of a method call, but how do I call the method and pass the value in? The method signature is: String getColor(Double Val)
Here is the method:
public string getColor(Double val){
color = '';
if(val >= 0 && val < 25){
color='background-color:#FF0000;';
}
if(val >= 25 && val < 50){
color='background-color:#FF1493;';
}
if(val >= 50 && val < 75){
color='background-color:#FFB6C1;';
}
if(val >= 75 && val < 85){
color='background-color:#FFFF00;';
}
if(val >= 85 && val < 95){
color='background-color:#ADFF2F;';
}
if(val >= 95 && val < 100){
color='background-color:#9ACD32;';
}
if(val == 100){
color='background-color:#228B22;';
}
return color;
}
And this is how I'm calling it:
<apex:column headervalue="SitNum" style="{!color(defendNTAPNum[o.id])}">
Thank you for your feedback!