Documents for Excel .NET Edition | GCDocuments
Features / Chart / Configure Chart / Chart Area
In This Topic
    Chart Area
    In This Topic

    In GcExcel .NET, you can use the properties of the IChartArea interface to set up the chart area as per your preferences.

    Configure chart area style

    You can configure the chart area style by changing its font, format and other attributes using the Font propertyFormat property and RoundedCorners property of the IChartArea interface.

    Refer to the following example code to configure chart area style in your worksheet.

    C#
    Copy Code
    //Configure chart area style
    IShape shape = worksheet.Shapes.AddChart(ChartType.Column3D, 200, 100, 300, 300);
    worksheet.Range["A1:D6"].Value = new object[,]
    {
        {null, "S1", "S2", "S3"},
        {"Item1", 10, 25, 25},
        {"Item2", -51, -36, 27},
        {"Item3", 52, -85, -30},
        {"Item4", 22, 65, 65},
        {"Item5", 23, 69, 69}
    };
    shape.Chart.SeriesCollection.Add(worksheet.Range["A1:D6"], RowCol.Columns, true, true);
    
    IChartArea chartarea = shape.Chart.ChartArea;
    //Format.
    chartarea.Format.Fill.Color.RGB = Color.Gray;
    chartarea.Format.Line.Color.RGB = Color.Gold;
    chartarea.Format.ThreeD.RotationX = 60;
    chartarea.Format.ThreeD.RotationY = 20;
    chartarea.Format.ThreeD.RotationZ = 100;
    chartarea.Format.ThreeD.Z = 20;
    chartarea.Format.ThreeD.Perspective = 20;
    chartarea.Format.ThreeD.Depth = 5;
    //Font
    chartarea.Font.Bold = true;
    chartarea.Font.Italic = true;
    chartarea.Font.Color.RGB = Color.Red;
    //Rounded corners.
    chartarea.RoundedCorners = true;