Can't find what you're looking for?

Contact us or post in our forums and we'll help you find an answer.

How to create a 2D Pie Chart in ActiveReports

Background

This article shows you how to make a basic 2D Pie Chart.

(Download the report template before reading through steps)

Web-Designer solution

Add Chart

Set Chart to Pie Chart

Optional: Change the Chart Title to Units in Stock for each Product Category

Add “UnitsInStock” To DataFields and “CategoryName” to Encodings
a. Make sure the expression is =Fields!UnitsInStock.Value and not =Sum(Fields!UnitsInStock.Value)

Set the Aggregate for the encoding to Count

Select Plot 1 in the Report Explorer and view the properties for the chart

Under Common Properties, set ToolTip template to Value Field Value

Under Encodings, expand the color property and click the add item button.
a. Enter the following expression for the new item
b. =Fields!CategoryName.Value

Under Label Text, set the template property to Value Field Value and set the position property to Center

Select the preview button to view the finished Pie Chart

Visual Studio Add-in/ Desktop Designer solution

Add Chart

Select Pie as the Chart Template

Click inside the chart until you see the Data Fields and Encodings sections popup above and to the side of the chart

Goto the Report Explorer and under the Products dataset, drag the UnitsInStock field to the Data Fields section and drag the CategoryName field to the encodings section

In the Report Explorer, select Chart 1 and goto the properties.

In Chart 1 properties, do the following
a. Goto the Plots property and open up the plot collection
b. In the PlotDesigner Collection Editor, select Plot 1 and open the values collection in editor properties
c. In the DataFields Collection Editor, make sure that the first member is "Units in Stock" and set the Aggregate property to Count

In the Report Explorer, select Plot 1 for the new chart that you added.

After selecting Plot 1, open the properties for Plot 1 and do the following:
a. set the ToolTip Template properrty to {valueField.value}
b. Expand the Color property and add a value to the collection with this expression =Fields!CategoryName.Value
c. Expand the Labels property and set TextPosition to Center, and Template to {valueField.value}

To remove the numbers on the outside of the chart, click in the white space of the chart until you see the Axes properties appear

Open the Axes Collection and do the following
a. In the AxisDesigner Collectin Editor, select Axis 2 and set the Position Property to None

Click the preview button to preview the Pie Chart

Resources

Gif - https://global-cdn.grapecity.com/kb/activereports/ard/HowToCreatePieChart.gif
Sample Template with data - https://global-cdn.grapecity.com/kb/activereports/ard/PieChartExample - template.rdlx
PieChartSample - https://global-cdn.grapecity.com/kb/activereports/ard/PieChartExample.rdlx

Get the Latest Version of ActiveReports .NET
Download the Free Trial Now