How to create an inline bar chart


Here’s a neat trick a co-worker and I discovered this afternoon for creating an inline bar chart (an inline data visualization in a table or other data region).


1. Add an embedded image to your report that will serve as the “bar” (a simple horizontal gradient usually looks nice)


2. Add a column to your table, and place an Image report item in the detail row cell.


3. Select the embedded image from step 1 as the source for the Image report item.


4. Set the padding on the Image report item to adjust the size and position of the bar within the cell


5. [Here’s the kicker] Create an expression for the right (or left) padding that divides a field value by some maximum value, clamps it to a given range if necessary using Math.Min/Max, and then multiplies by the total size of the bar.


Example: image1.Padding.Right=((1.0-(Math.Min(Math.Max(Fields!TotalSales.Value,0),100000)/100000))*72) & “pt”

Comments (2)

  1. bvramana2007 says:

    I wonder if there is a possibility to add background color gradient to any text box like in css styles: style="width: 100%; filter:progid:DXImageTransform.Microsoft.Gradient(GradientType=1,StartColorStr=#DBCF23,EndColorStr=003399)"