2D Chart for WinForms | ComponentOne
Specific 2D Charts / Pie and Doughnut Charts / Special Pie Chart Properties
In This Topic
    Special Pie Chart Properties
    In This Topic

    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.

    Clockwise or Counter-Clockwise Direction

    Setting the property Clockwise to True draws each series in the pie in clockwise direction and setting it to False draws each series in the pie in counter-clockwise direction.

    The following images display two pie charts with one drawn in counter-clockwise and the other in clockwise direction.

    Counter-clockwise (default) Clockwise

    Starting Angle

    Use the Start property to specify the angle at which the slices for the first series start. The default angle is 0 degrees. The angle represents the arc between the most clockwise edge of the first slice and the right horizontal radius of the pie, as measured in the counter-clockwise direction (see image below). Start is a property of the Pie class and can be accessed at design time through the Pie node of the ChartGroupsCollection Editor.

    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 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.

    Exploding slices can be set programmatically, and can be set for the series only:

    To write code in Visual Basic

    Visual Basic
    Copy Code
    'Get the appropriate ChartData object.
    Dim cd As ChartData = C1Chart1.ChartGroups.ChartGroupsCollection(0).ChartData
    
    'Sets the offset for the first series to 10% of the pie's radius
    cd.SeriesList(0).Offset = 10
    
    'Resets the exploded slices.
    cd.SeriesList(0).Offset = 0
    

    To write code in C#

    C#
    Copy Code
    //Get the appropriate ChartData object.
    ChartData cd = c1Chart1.ChartGroups.ChartGroupsCollection[0].ChartData;
    
    //Sets the offset for the first series to 10% of the pie's radius
    cd.SeriesList[0].Offset = 10;
    
    //Resets the exploded slices.
    cd.SeriesList[0].Offset = 0;
    
    See Also