Chart for WinRT > Chart Types > Pie Charts |
Pie charts are commonly used to display simple values. They are visually appealing and often displayed with 3D effects such as shading and rotation.
Pie charts have one significant difference when compared to other C1Chart chart types in Pie charts; each series represents one slice of the pie. Therefore, you will never have Pie charts with a single series (they would be just circles). In most cases, Pie charts have multiple series (one per slice) with a single data point in each series. C1Chart represents series with multiple data points as multiple pies within the chart.
XAML Markup |
Copy Code
|
---|---|
<Chart:C1Chart x:Name="chart0" Height="650" Width="750" ChartType="Pie" Palette="Solstice" Foreground="Black"> <Chart:C1Chart.Data> <Chart:ChartData > <Chart:ChartData.Children> <Chart:DataSeries Values="12 15 17 12 8" SymbolStrokeThickness="0" Opacity="0.9"/> </Chart:ChartData.Children> </Chart:ChartData> </Chart:C1Chart.Data> </Chart:C1Chart> |
Pie charts are quite different from the other chart types since they do not follow the concept of a two-dimensional grid or axes. Altering the diameter of the pie or the properties of the exploding slices can be accomplished with the properties of the Pie class.
Starting Angle
The PieOptions.SetStartingAngle property defines the position of the first slice within the Pie Chart. The first slice always begins at 90 degrees. The Start Angle runs clockwise from the 90 degree angle.
Use the PieOptions.SetStartingAngle property to specify the angle at which the slices for the first series start. You can see what happens when you set the Start Angle to 90 in the image below:
Exploding Pies
A slice of a Pie chart can be emphasized by exploding it, which extrudes the slice from the rest of the pie. Use the BasePieRenderer.Offset property of the series to set the exploded slice's offset from the center of the pie. The offset is measured as a percentage of the radius of the pie.
C# |
Copy Code
|
---|---|
// explode slice slice.Offset = 20; |
The code above is taken from the WinRT Chart Samples - PieSliceExplode. An exploded slice will resemble the following image:
Chart for WinRT supports the following types of Pie charts:
Pie Chart
PieDoughnut
PieExploded
PieExplodedDoughnut
PieStacked