In this article ,we will see how to create a Chart in SSRS(RDLC) Report.
Asp.Net provides a wonderful reporting tool using which we can create different kinds of charts like Line chart, bar chart,pie chart etc. in addition to tabular reports.
To create a column chart to show category-wise total sale made.
1.Create a Procedure to fetch the required data for your report.
2.Add a Chart Control to report file i.e RDLC file and the fields to it.
3.Report-viewer to run the Report
Using the code
// 1. Procedure to fetch product-wise sales amount create procedure spProductDetails
select Categories.CategoryName ,Total=sum((Quantity *
[Order Details].UnitPrice-Discount ) )from [Order Details] ,Products,Categories
where products.ProductID=[Order Details].ProductID and Categories .CategoryID=Products .CategoryID
group by Categories.CategoryName
// 2.Add Chart Control to RDLC
Add an appropriate chart control to the Rdlc file, in this article i have added a column chart.Then drag the categoryname field to the category axis and total to value box as shown in the diagram below and save the file
//3.Add a Report Viewer to the ASPX page from the toolbox <form id="form1" runat="server">
<rsweb:ReportViewer ID="ReportViewer1" runat="server" Font-Names="Verdana"
Font-Size="8pt" Height="400px" Width="674px">
<asp:ObjectDataSource ID="ObjectDataSource1" runat="server"
Run the Report, you will have the following output.
Conclusion From the above discussion it is very much clear that creating a chart in SSRS (RDLC) is an easy task. In this way we can add different kinds of charts as per requirement.