Quantcast
Channel: SQL Server Reporting Services, Power View forum
Viewing all articles
Browse latest Browse all 10045

Using Custom Code to Create a Heatmap

$
0
0

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


Viewing all articles
Browse latest Browse all 10045

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>