New to Telerik ReportingStart a free 30-day trial

Creating and Customizing Area Charts

An Area chart displays a series as a set of points connected by a line with the whole area filled in under the line.

Area charts are appropriate for visualizing data that fluctuates over a period of time and can be useful for emphasizing trends. Values with gradual variation work best for Area charts.

The following image shows an example of a Stacked Area chart:

Preview of Graph Item with Stacked Area Chart

Types

The Graph supports the following Area chart types:

  • Stacked Area Charts—An Area chart where multiple series are stacked vertically. If there is only one series in the chart, the Stacked Area chart appears the same as an Area chart.
  • 100% Percent Stacked Area Charts—An Area chart where multiple series are stacked vertically to fit the entire chart area. If there is only one series in the chart, the Stacked Area chart appears the same as an Area chart.
  • Smooth Area Charts—An Area chart where data points are connected by a smooth line instead of a straight line. Smooth Area charts are suitable for displaying trends rather than individual data point values.

Creating Area Charts with the Area Chart Wizard

The following steps demonstrate how to create a Stacked Area chart using the Area Chart Wizard. In this example, the chart compares total monthly sales by year.

The sample report uses a SqlDataSource connected to the AdventureWorks sample database. The query below returns the required fields:

SQL
SELECT
    [Sales].[SalesOrderHeader].[OrderDate],
    [Sales].[SalesOrderDetail].[LineTotal]
FROM
    [Sales].[SalesOrderDetail] INNER JOIN
    [Sales].[SalesOrderHeader] ON [Sales].[SalesOrderDetail].[SalesOrderID] = [Sales].[SalesOrderHeader].[SalesOrderID]

To create the Stacked Area chart by using the Area Chart Wizard:

  1. Add a Stacked Area chart:

    Adding the Telerik Reporting Area Chart Wizard from the Insert Menu Item of the Standalone Report Designer

  2. Select the SqlDataSource, or create it with the Add New Data Source... button and by using the query above:

    Add DataSource to the Area Chart with the Wizard of the Standalone Report Designer

  3. Arrange the Area Chart:

    1. Drag the OrderDate.Month field to Categories.
    2. Drag the OrderDate.Year field to Series.
    3. Drag the LineTotal field to Values. The wizard automatically applies the Sum aggregate function.

    Arrange the Area Chart Series, Categories and Values from the Wizard in the Standalone Report Designer

  4. The LineTotal value is large. Change the Data > Y expression of areaSeries from =Sum(Fields.LineTotal) to =ISNULL(Sum(Fields.LineTotal), 0) / 1000.0. The expression includes a null check that replaces null values with 0.

  5. Set the Graph Category's Label to = Format("{0:MMM}", Fields.OrderDate). This formats the Category labels to show the month abbreviation instead of the month number.

For the full report implementation, see the AreaChart.trdp sample on GitHub.

Creating Area Charts Manually

The following steps create a Stacked Area chart without the wizard.

1. Add the Graph

Add a new Graph report item to the report as described in Getting Started with the Graph Report Item.

2. Set the SeriesGroups Hierarchy

Set the SeriesGroups hierarchy:

  1. Open the SeriesGroups collection editor and click Add.
  2. Set Groupings to =Fields.OrderDate.Year.
  3. Set Sortings to =Fields.OrderDate.Year.
  4. Set Name to seriesGroup1.

3. Set the CategoryGroups Hierarchy

Define the CategoryGroups hierarchy:

  1. Open the CategoryGroups collection editor and click Add.
  2. Set Groupings to =Fields.OrderDate.Month.
  3. Set Sortings to =Fields.OrderDate.Month.
  4. Set Name to categoryGroup1.

4. Configure the Coordinate System

Specify the coordinate system details:

  1. Open the CoordinateSystems collection editor and Add a new CartesianCoordinateSystem.
  2. Leave Name as cartesianCoordinateSystem1.
  3. Set XAxis to New Axis with Category Scale.
  4. Set YAxis to New Axis with Numerical Scale.

5. Configure the Series

Configure the series:

  1. Open the Series collection editor and Add a new AreaSeries.
  2. Set CategoryGroup to categoryGroup1.
  3. Set SeriesGroup to seriesGroup1.
  4. Set CoordinateSystem to cartesianCoordinateSystem1.
  5. Set ArrangeMode to Stacked.
  6. Set the Y value to =ISNULL(Sum(Fields.LineTotal), 0) / 1000.0.

6. Style the Appearance

For color palette, label formatting, legend configuration, and other styling options, see Formatting a Graph.

See Also