Document Solutions for Excel, .NET Edition | Document Solutions
Features / Chart / Configure Chart / Plot Area
In This Topic
    Plot Area
    In This Topic

    In DsExcel .NET, you can use the properties of the IPlotArea Interface to set up the plot area in a chart as per your preferences.

    Configure plot area format

    You can configure the plot area format by changing its fill color, line color and other attributes using the Format property of the IPlotArea interface.

    Refer to the following example code to configure plot area format for a chart inserted in your worksheet.

    C#
    Copy Code
    GrapeCity.Documents.Excel.Drawing.IShape shape = worksheet.Shapes.AddChart(GrapeCity.Documents.Excel.Drawing.ChartType.ColumnClustered, 250, 20, 360, 230);
    worksheet.Range["A1:D6"].Value = new object[,]
    {
        {null, "S1", "S2", "S3"},
        {"Item1", 10, 25, 25},
        {"Item2", -51, 36, 27},
        {"Item3", 52, 50, -30},
        {"Item4", 22, 65, 30},
        {"Item5", 23, 40, 69}
    };
    shape.Chart.SeriesCollection.Add(worksheet.Range["A1:D6"], GrapeCity.Documents.Excel.Drawing.RowCol.Columns, true, true);
    
    // Format
    GrapeCity.Documents.Excel.Drawing.IPlotArea plotarea = shape.Chart.PlotArea;
    plotarea.Format.Fill.Color.RGB = Color.LightGray;
    plotarea.Format.Line.Color.RGB = Color.Gray;
    plotarea.Format.Line.Weight = 1;