New to Telerik Reporting? Download free 30-day trial

Creating the Graph

This article is part of the Demo report guide on getting started with Telerik Reporting and demonstrates how to create a Graph item in the Report Header.

The controls which the Report Header and the Report Footer contain are displayed only once at the top and bottom of the entire report respectively. The controls which the pageHeaderSection and the pageFooterSection are displayed on all pages. The Report Header and Report Foote r are hidden by default.

  1. To show the report header, right-click outside the report and select Report Header.

  2. Add a new SQL Datasource component for the graph with the following query:

    P.Name AS ProductName, SOD.LineTotal / 1000 AS LineTotal,
    SS.Name AS StoreName,
    C.FirstName + ' ' + COALESCE (C.MiddleName, '') + ' ' + C.LastName AS SalesPersonFullName
    Production. Product AS P
    INNER JOIN Sales.SalesOrderDetail AS SOD ON P.ProductID = SOD.ProductID
    INNER JOIN Sales.SalesOrderHeader AS SOH ON SOD.SalesOrderID = SOH.SalesOrderID
    INNER JOIN Sales.Store AS SS             ON SS.CustomerID = SOH.CustomerID
    INNER JOIN Sales.SalesPerson AS SP       ON SP.SalesPersonID = SOH.SalesPersonID
    INNER JOIN HumanResources.Employee AS E  ON E.EmployeeID = SP.SalesPersonID
    INNER JOIN Person.Contact AS C           ON C.ContactID = E.ContactID
    WHERE     (YEAR(SOH.OrderDate) = 2002)
  3. Rename the datasource to graphDataSource.

  4. Click reportHeaderSection.

  5. Select Insert > Pie > graphDataSource.

  6. Drag StoreName to Series.

  7. Drag LineTotal to Values.


  8. Click Finish and select the newly created Graph in order to add Filtering and Sorting.

  9. From the Group Explorer (Series Groups), click Filter and set the following parameters:

    • Expression : =Sum(Fields.LineTotal)

    • Operator : Top N

    • Value : =5

  10. From the Group Explorer (Series Groups), click Sorting and set the following parameters:

    • Expression : =Sum(Fields.LineTotal)

    • Direction : DESC

  11. From the Properties grid, select the Color Palette option to set the colors for each bar series:

    Color [A=255, R=0, G=105, B=104],
    Color [A=255, R=88, G=168, B=35],
    Color [A=255, R=137, G=203, B=42],
    Color [A=255, R=34, G=181, B=115],
    Color [A=255, R=32, G=176, B=212]
  12. Add the title of the graph by inserting a TextBox with Value "Top 5 Stores". Put Shapes next to the text.

Previewing the Result

Preview the result by clicking Preview > PrintPreview.

Report With Graph

Next Steps

Previous Steps

In this article
Not finding the help you need? Improve this article