Progress® Telerik® Reporting R2 2017

How to: Create Line Chart

In this article we will show you how to create a Line chart using the Graph item.

Line Chart
  1. Add a new graph item to the report.

    1. Set the DataSource property to a new SqlDataSource.

    2. Set the connection string to the demo AdventureWorks database.

    3. Set the query to the following one:

      SELECT PC.Name AS ProductCategory, SOD.LineTotal, SOH.OrderDate
      FROM Production.Product AS P
      INNER JOIN Production.ProductSubcategory AS PS ON P.ProductSubcategoryID = PS.ProductSubcategoryID
      INNER JOIN Production.ProductCategory AS PC ON PS.ProductCategoryID = PC.ProductCategoryID
      INNER JOIN Sales.SalesOrderDetail AS SOD ON P.ProductID = SOD.ProductID
      INNER JOIN Sales.SalesOrderHeader AS SOH ON SOD.SalesOrderID = SOH.SalesOrderID
    4. You can click on Execute Query... just to check if everything is OK with the database connection. Click Finish when you are ready.

  2. Open SeriesGroups collection editor and click Add:

    1. Set the new group Groupings to: =Fields.ProductCategory

    2. Set the Sortings to: =Fields.ProductCategory

    3. Set the Name to seriesGroup1

  3. Open CategoryGroups collection editor and click Add:

    1. Set the new group Groupings to: =Fields.OrderDate.Year

    2. Set the Sortings to =Fields.OrderDate.Year

    3. Set the Name to categoryGroup1

  4. Open CoordinateSystems collection editor and Add a new CartesianCoordinateSystem.

    1. Leave the Name to cartesianCoordinateSystem1.

    2. Set the XAxis to New Axis with Category Scale.

    3. Set the YAxis to New Axis with Numerical Scale.

  5. Open Series collection editor and Add new LineSeries.

    1. Set the CategoryGroup to categoryGroup1.

    2. Set the SeriesGroup to seriesGroup1.

    3. Set the CoordinateSystem to cartesianCoordinateSystem1.

    4. Set the Y value to =Sum(Fields.LineTotal)

  6. Set the color palette, the formatting of the labels, the values of the legend and any other improvements as needed.

    For more information, see Formatting a Graph.