Below is code I am using to create a heatmap in SSRS. THe code seems to be working well except for one glitch. Sometimes numbers in the "middle of the pack" are white. Obviously they should be one the of colors listed below. Any ideas why numbers would be white when I declared only white for IsNothing.
Public Function GetHeatmapColor(ByVal textBoxValue, ByVal minDataSetValue, ByVal maxDataSetValue) As String
Dim colours As String() = New String() {"White","DarkGreen","Green","ForestGreen","LimeGreen","YellowGreen","Yellow","Gold","Orange","DarkOrange","OrangeRed","Red"}
If IsNothing(textBoxValue) = True Then
Return colours(0)
End If
If minDataSetValue = maxDataSetValue Then
Return colours(1)
End If
If textBoxValue > maxDataSetValue Then
Return colours(colours.Length - 1)
End If
Dim divider As Integer = (maxDataSetValue - minDataSetValue + 1) / 11
Dim x As Integer = textBoxValue / divider
GetHeatmapColor = colours(X+1)
End Function