May 2007 - Posts

Australian Web 2.0 Applications

The Dandelife blog put me on to Particls and the Particls blog which in turn took me to a re-post-worthy "The Top 60 Web 2.0 Applications in Australia" (Particles is based in Oz as far as I can tell).

The top 60 Web 2.0 applications is an interesting list, and I ended up clicking through to a few sites. Well worth a read.

Tags: web 2.0, rss, desktop, australian

Buttons

Last week there was a post on Lifehacker about a free online button maker (the post also mentioned "Classy Glassy Buttons", a site I have used before).

I've found that there's lots of tutorials for making modern looking buttons in Photoshop, some with downloadable Photoshop files, but not having Photoshop means I can only "ooh" and "aah" at the resulting output. If I was to use a tool for making graphic elements like buttons or tabs for use on web pages, it would need to be free. Since my main line of work is not graphic design, so I don't have the interest or expertise in making and manipulating layers/filters/masks etc.

The post on Lifehacker prompted me to reflect on the primary button-making "tool" I use, which, although not free, I already own. I should add a disclaimer to that last sentence - the "tool" I'm spruiking is source code that requires Visual Studio 2005, and the end result isn't exactly images files (this involves a manual step of taking screenshots).

The two Visual Studio 2005 projects I have used are "GelButton" by Chris Jackson and "Improved and Recoded RibbonMenuButton" from CodeProject. Both are worth a read if you want to create buttons in Windows forms. However, I only need images from those projects for a web site.

My method is to create a new Windows form, set up "hot" and "cold" state buttons, add my own text, and then take screenshots. Finally, edit the screenshots in a program like Paint.NET and save as GIF/PNG/JPG (whatever's appropriate).

Using Visual Studio means I can tap into the power of custom drawing and also harness other people's work towards nice-looking buttons.

What methods do you use?

Tags: buttons, design

Reporting Services Heatmap

In Reporting Services, the syntax for changing the text color of a table cell, say to red if the value is negative, is to set the "Color" property to this expression:

=IIf(Me.Value < 0, "Red", "Black")

Another useful formatting tool is changing the background color of a cell depending on the cell's value, perhaps to achieve a "heatmap" effect. I find it's far better to do this using code than the macro-type language I used above.

Setting the background color in code can be achived by putting an expression like the following into the "BackgroundColor" property, replacing the section in square brackets with the same expression in the cell's "Value" property:

=Code.GetHeatmapColor([cell value or calculation], "White")

The second parameter is for a default color. You may or may not want to use it.

My sample code for "GetHeatmapColor" will be a simple SELECT CASE. First you need to define how the "heatmap" will work. For this example, "0" (or below) is the worst possible value and will appear dark red. "10" (or above) is the best possible value and will have no color at all.

Here's the code for "GetHeatmapColor", which accepts a double:

' Returns a background color from dark red to light pink (hey, that's what you get 
' when you mix red and white) based on how far off target (in this case, 10) the
' passed value is.
Public Function GetHeatmapColor( _
        ByVal dblActual As Double, _
        ByVal strNeutralColor As String) As String
   
    ' measure how far the result is from the target (10), and grade the colors accordingly
    ' in blocks of 2 (you get the idea, anyway)
    Select Case CInt(dblActual - 10)
        Case < -10
            ' below zero (way off our target of 10)...return worst color
            Return "#FF8282"
        Case < -8
            ' off target - either 0 or 1
            Return "#FF9191"
        Case < -6
            Return "#FFA0A0"
        Case < -4
            ' Noticeably off target
            Return "#FFAFAF"
        Case < -2
            Return "#FFBDBD"
        Case < 0
            ' mildly off target - either 8 or 9
            Return "#FFCACA"
        Case Else
            ' on or above target (10) - return neutral color
            Return strNeutralColor
    End Select
   
End Function

And lastly here's a screenshot of a simple report that uses this exact code, the first column is ascending and the second is mixed up. Note how easy it is to pick the worst and best values in the second column because of the "heatmap" colors:

Click here if the picture does not display

I generated the colors by finding the darkest acceptable color (not quite red) that black text was still readable on top of, then creating a gradient using Paint.NET fading from this color to white, then finally using a "pixelate" effect in Paint.NET to remove the gradient smoothness and get definite colors. I'm sure you can think of better ways to do this!

I hope this code is able to help someone. As always, it worked on my machine; I make no guarantees for yours!

Tags: reporting services, heatmap, color, visualisation