Search

Advertisements

SSRS - PIE chart

In this article , let us see an example for creating SSRS PIE chart .

Let us try to create Pie chart like in MSDN forum users profile .

Drag & drop , Pie chart on to the report body :

From Toolbox - > Report Items - > Chart - > Shape - > Pie
or Under Design pane - > right click on report body - > Insert - >  Chart - > Shape - > Pie





Create Dataset with below sample query :

DECLARE @tmp TABLE (Activities VARCHAR(50),Cnt INT,Sort TINYINT)
INSERT @tmp SELECT 'Galleries' , 700 , 1
INSERT @tmp SELECT 'TechNet Wiki' , 250 , 2
INSERT @tmp SELECT 'Blogs' , 200 , 3
INSERT @tmp SELECT 'Forums' , 2500 , 4
INSERT @tmp SELECT 'Translation' , 100 , 5
SELECT * FROM @tmp



Click on the any corner of the chart area - > Chart Data - > Assign Fields from the Dataset .
Edit the Chart title with appropriate title .



If we preview the report , it will look like as shown below :



Click on the Legend - > right-click - > Legend properties ... - > 
If you want to adjust anything (Position , Font  or Visibility etc ..) .

Click on the Pie chart - > Press F4 - > Properties and then set the Data labels visibility and Tooltip options .



If you want to sort the sections of Pie chart , Under Chart Data - > Category Groups - >
Category Group Properties .. - > Sorting - >




If you want to format color for each sections of Pie chart - > click on chart - > right-click
-> Series Properties ... - > Fill - > Color and then write expression like this :

=Switch(Fields!Activities.Value = "Galleries" , "#0010A5" ,
Fields!Activities.Value = "TechNet Wiki" , "#FEC500" ,
Fields!Activities.Value = "Blogs" , "#FF0000" ,
Fields!Activities.Value = "Forums" , "#0FAD00" ,
Fields!Activities.Value = "Translation" , "#6300A5")




If we preview the report , it will look like as shown below :


 

No comments:

Advertisements