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 Control
- 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
- 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.
- Enter the following expression for the new item
- =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
- Go to 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:
- Go to the Plots property and open up the plot collection
- In the PlotDesigner Collection Editor, select Plot 1 and open the values collection in editor properties
- 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:
- Set the ToolTip Template properrty to {valueField.value}
- Expand the Color property and add a value to the collection with this expression =Fields!CategoryName.Value
- 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
Evan Warren