Tutorial: Adding a Pie Chart to a Report (Report Designer)
Pie charts and doughnut charts display data as a proportion of the whole. Pie charts are most commonly used to make comparisons between groups. Pie and doughnut charts, along with pyramid and funnel charts, constitute a group of charts known as shape charts. Shape charts have no axes. When a numeric field is dropped on a shape chart, the chart calculates the percentage of each value to the total. For more information on Shape charts, see Shape Charts (Report Builder 3.0 and SSRS).
If there are too many data points on a pie chart, your data points may become crowded which reduces the readability of your chart. In this scenario, you may want to consider using a line chart. Consider using pie charts only once you have aggregated your information to several data points or less.
Requirements
To use this tutorial, the system must have the following installed:
SQL Server Business Intelligence Development Studio.
Note
Business Intelligence (BI) Development Studio is not supported on Itanium-based computers. However, support for BI Development Studio is available for x64-based computers. If the SQL Server sample databases have been deployed on an Itanium-based computer, use BI Development Studio on either an x86-based or x64-based computer to modify and run the samples.
SQL Server with the AdventureWorks2008 sample database.
Estimated time to complete this tutorial: 10 minutes.
To define a data source for the pie chart
On the View menu, click Report Data. The Report Data pane appears in your Business Intelligence Development Studio environment.
In the Report Data pane, click New, and then click Data Source.
In the Data Source Properties dialog box, verify that Embedded connection is selected.
Click Edit.
In the Connection Properties dialog box, enter the name of your server in the Server name text box.
Click Use Windows Authentication or click SQL Server Authentication and type the name and password of a user that has permission to access the AdventureWorks2008 database.
In the Select or enter a database name box, type or select the AdventureWorks2008 database.
Click OK. The new data source (DataSource1 by default) is displayed in the Report Data pane.
To define a data set for your report
In the Report Data pane, right-click the data source you created in the previous step, and click Add Dataset.
In the Dataset Properties dialog box, enter the following query in the Query textbox:
SELECT [FullName] as Name ,[2002] as SalesBeforeLast ,[2003] as SalesLastYear ,[2004] as SalesYTD FROM [Sales].[vSalesPersonSalesByFiscalYears]
Click OK.
To add a pie chart to your report
On the View menu, click Toolbox.
Double-click the Chart icon or drag-and-drop it from the Toolbox to the design surface.
In the Select Chart Type dialog box, click Shape. Select the first pie chart icon in the list.
Drag the Name field from the Report Data pane and drop it in the category fields drop zone.
Drag the SalesYTD field from the Report Data pane and drop it in the data fields drop zone.
Click Preview on the ribbon.
To display percentages in each slice of the pie chart
Right-click the pie chart and click Show Data Labels. The data labels will appear on the chart.
Right-click any label and click Series Label Properties.
In the Series Label Properties dialog box, select #PERCENT in the Label data box.
(Optional) To specify how many decimal places the label should show, specify "#PERECENT{Pn}" where n is the number of decimal places to display. For example, if you want to format the keyword to two decimal places, use the string "#PERCENT{P2}".
Note
Number Format in the Series Label properties dialog box will have no effect when you format percentages. This will only format the labels as percentages, but it will not calculate what percentage of the pie chart each slice represents.
To add a drawing effect to the pie chart
On the View tab, choose the Property Pane option.
Click on the pie chart. The series properties for the pie chart are shown in the Property pane.
In the Property pane, expand the CustomAttributes node.
Set the PieDrawingStyle to SoftEdge.
Note
If we set the chart to be 3-D the drawing effects are no longer applicable.
To combine any slices on the pie chart smaller than 5 percent into one slice
Open the Properties pane.
On the design surface, click on any slice of the pie chart. The properties for the series are displayed in the Properties pane.
In the General section, expand the CustomAttributes node.
Set the CollectedStyle property to SingleSlice.
Set the CollectedThresholdUsePercent property to True.
Set the CollectedThreshold property to 5.