Chart Area

Spread.Services Documentation
Chart Area
Collapse All Expand All

Spread.Services Documentation > Developer's Guide > Manage Data in Spread Component > Use Chart > Configure Chart > Chart Area

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

This topic includes the following tasks:

- Configure chart area style
- Set chart area format

### Configure chart area style

You can configure the chart area style by changing its font, format and other attributes using the Font property, Format 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;

### Set chart area format

Refer to the following example code to set chart area format in your worksheet.

C# | Copy Code
--- | ---

    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;

Copyright © GrapeCity, inc. All rights reserved.