How to Create Area Chart
In this article we will show you how to create an Area chart using the Graph item.
-
Add a new graph item to the report.
Set the DataSource property to a new SqlDataSource.
Set the connection string to the demo AdventureWorks database.
-
Set the query to the following one:
SELECT SOD.LineTotal, SOH.OrderDate, PC.Name AS Category FROM Sales.SalesOrderHeader AS SOH INNER JOIN Sales.SalesOrderDetail AS SOD ON SOH.SalesOrderID = SOD.SalesOrderID INNER JOIN Production.Product AS P ON SOD.ProductID = P.ProductID INNER JOIN Production.ProductSubcategory AS PS ON P.ProductSubcategoryID = PS.ProductSubcategoryID INNER JOIN Production.ProductCategory AS PC ON PS.ProductCategoryID = PC.ProductCategoryID
You can click on Execute Query... just to check if everything is OK with the database connection. Click Finish when you are ready.
-
Open SeriesGroups collection editor and click Add :
Set the Groupings to: =Fields.OrderDate.Year
Set the Sortings to: =Fields.OrderDate.Year
Set the Name to seriesGroup1
-
Open CategoryGroups collection editor and click Add :
Set the Groupings to: =Fields.OrderDate.Month
Set the Sortings to =Fields.OrderDate.Month
Set the Name to categoryGroup1
-
Open CoordinateSystems collection editor and Add a new CartesianCoordinateSystem.
Leave the Name to cartesianCoordinateSystem1.
Set the XAxis to New Axis with Category Scale.
Set the YAxis to New Axis with Numerical Scale.
-
Open Series collection editor and Add new AreaSeries.
Set the CategoryGroup to categoryGroup1.
Set the SeriesGroup to seriesGroup1.
Set the CoordinateSystem to cartesianCoordinateSystem1.
Set the ArrangeMode to Stacked.
Set the Y value to =ISNULL(Sum(Fields.LineTotal), 0) / 1000.0
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.