Pie Chart Data Label Positioning
When working with pie charts in SSRS, data labels are displayed inside the pie segments by default. This can lead to overlapping text and poor readability, especially when dealing with multiple categories. To improve clarity, position data labels outside the pie chart:
- Open the Properties panel (press F4)
- Select the data labels within the pie chart
- In the Properties panel, locate the Position property and set it to Outside
For enhanced visual connection between labels and their corresponding segments, consider enabling 3D effects:
- Select the pie chart
- Right-click and choose 3D Effects
- Enable the 3D option
Displaying Values as Percentages
To convert numeric values to percentages in SSRS, use the FormatPercent function. The basic calculation follows the formula: percentage = value / total. For implementation:
- Select the data labels in the pie chart
- Right-click and choose Label Properties
- In the General tab, click the fx button next to Label data
- Enter the following expression:
=FormatPercent(Fields!Value.Value / Sum(Fields!Value.Value, "DatasetName"), 2)
This expression uses the FormatPercent function with two parameters: the numeric value to convert and the number of decimal places to display. When prompted about the UseValueAsLabel property, set it to false to ensure custom formatting is applied.
Alternating Row Colors in Tables
To improve readability of tabular data, implement alternating row colors:
- Open the Properties panel
- Select the table data rows (not headers)
- In the Properties panel, locate the BackgroundColor property
- Enter the following expression:
=IIf(RowNumber(Nothing) Mod 2 = 0, "#F0F0F0", "White")
Print and Export Configuration
To prevent formatting issues when printing or exporting reports to formats like PDF:
- Right-click on the report's blank area and choose Report Properties
- In the Page Setup tab, configure the page size (e.g., A4)
- Note the automatic width and height values for the selected page size
- Open the Properties panel
- Click on the report's blank area
- In the Properties panel, set the Size dimensions to equal or less than the page dimensions
Adding Row Numbers to Tables
To include row numbers in a table:
- Add a textbox in the table's detail row
- Enter the following expression in the textbox:
=RowNumber(Nothing)
Implementing Custom Functions
When built-in functions are insufficient, create custom functions in VB.NET. For example, to dynamically set background colors from RGB values:
- Right-click on the report's blank area and choose Report Properties
- Select the Code tab
- Add the custom function:
Public Function SetRGB(rgbValue As String) As String
Dim rgbParts() As String = rgbValue.Split(",")
If rgbParts.Length = 3 Then
Return "#" &
Convert.ToInt32(rgbParts(0)).ToString("X2").PadLeft(2, "0"c) &
Convert.ToInt32(rgbParts(1)).ToString("X2").PadLeft(2, "0"c) &
Convert.ToInt32(rgbParts(2)).ToString("X2").PadLeft(2, "0"c)
End If
Return "White"
End Function
To call this function in a textbox's BackgroundColor property:
=Code.SetRGB("255,255,123")