What you want to see on DotNetFunda.com ?
Go to DotNetFunda.com
Twitter TwitterLinkedIn
YouTubeGoogle
 Online : 39584 |  Welcome, Guest!   Register  Login
Home > Articles > ASP.NET > Create Chart in SSRS(RDLC) Report

Create Chart in SSRS(RDLC) Report

Article posted by Sksamantaray on 3/31/2012 | Views: 7240 | Category: ASP.NET | Level: Beginner | Points: 200 red flag


In this article ,we will see how to create a Chart in SSRS(RDLC) Report.

Introduction

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.

Objective
To create a column chart to show category-wise total sale made.

 

Requisites

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
as
Begin
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   
End                                                                                   
// 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">
    <div>
    
        <rsweb:ReportViewer ID="ReportViewer1" runat="server" Font-Names="Verdana" 
            Font-Size="8pt" Height="400px" Width="674px">
            <LocalReport ReportPath="Report.rdlc">
                <DataSources>
                    <rsweb:ReportDataSource DataSourceId="ObjectDataSource1" 
                        Name="DataSet3_spProductDetails" />
                </DataSources>
            </LocalReport>
        </rsweb:ReportViewer>
        <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" 
            OldValuesParameterFormatString="original_{0}" SelectMethod="GetData" 
            TypeName="DataSet3TableAdapters.spProductDetailsTableAdapter">
        </asp:ObjectDataSource>
    
    </div>
    </form>                                
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.


If you like this article, subscribe to our RSS Feed. You can also subscribe via email to our Interview Questions, Codes and Forums section.

Page copy protected against web site content infringement by Copyscape
Found interesting? Add this to:



Please Sign In to vote for this post.

Experience:5 year(s)
Home page:
Member since:Sunday, November 06, 2011
Level:Silver
Status: [Member]
Biography:Scalable-Systems Pvt Ltd
>> Write Response - Respond to this post and get points
Related Posts

To perform CRUD operation (create, read, update and delete) operation with GridView, we can follow this approach.

A tutorial video which explains step by step to enable your asp.net application to consume application services like Membership,Roles,Profiles etc.

In this article explain you how to create datatable programmatically from a string using C#.

In this tutorial, we will learn to create our own custom template which can be used for creating web sites

This article describes how to specify an external AppSetting file from within web.config file and specify the settings value inside external file. It also describes related benefits and limitation of the external AppSetting file.

More ...
About Us | Contact Us | The Team | Advertise | Software Development | Write for us | Testimonials | Privacy Policy | Terms of Use | Link Exchange | Members | Go Top
General Notice: If you find plagiarised (copied) contents on this page, please let us know the original source along with your correct email id (to communicate) for further action.
Copyright © DotNetFunda.Com. All Rights Reserved. Copying or mimicking the site design and layout is prohibited. Logos, company names used here if any are only for reference purposes and they may be respective owner's right or trademarks. | 5/21/2013 5:47:31 PM