Class PlotArea

PlotArea class

Encapsulates the object that represents the plot area in a chart.

public class PlotArea : ChartFrame

Properties

NameDescription
virtual Area { get; }Gets the area.(Inherited from ChartFrame.)
virtual AutoScaleFont { get; set; }True if the text in the object changes font size when the object size changes. The default value is True.(Inherited from ChartFrame.)
Background { get; set; }(Obsolete.) Gets and sets the display mode of the background(Inherited from ChartFrame.)
BackgroundMode { get; set; }Gets and sets the display mode of the background(Inherited from ChartFrame.)
virtual Border { get; }Gets the border.(Inherited from ChartFrame.)
DefaultHeight { get; }Represents height of default position(Inherited from ChartFrame.)
DefaultWidth { get; }Represents width of default position(Inherited from ChartFrame.)
DefaultX { get; }Represents x of default position(Inherited from ChartFrame.)
DefaultY { get; }Represents y of default position(Inherited from ChartFrame.)
virtual Font { get; }Gets a Font object of the specified ChartFrame object.(Inherited from ChartFrame.)
override Height { get; set; }Gets or sets the height of plot-area bounding box in units of 1/4000 of the chart area.
InnerHeight { get; set; }Gets or sets the height of plot area in units of 1/4000 of the chart area.
InnerWidth { get; set; }Gets or sets the width of plot area in units of 1/4000 of the chart area.
InnerX { get; set; }Gets or gets the x coordinate of the upper top corner of plot area in units of 1/4000 of the chart area.
InnerY { get; set; }Gets or gets the x coordinate of the upper top corner of plot area in units of 1/4000 of the chart area.
override IsAutomaticSize { get; set; }Indicates whether the plot area is automatic sized.
IsDefaultPosBeSet { get; }Indicates whether default position(DefaultX, DefaultY, DefaultWidth and DefaultHeight) are set.(Inherited from ChartFrame.)
IsInnerMode { get; set; }Indicates whether the size of the plot area size includes the tick marks, and the axis labels. False specifies that the size shall determine the size of the plot area, the tick marks, and the axis labels.(Inherited from ChartFrame.)
Shadow { get; set; }True if the frame has a shadow.(Inherited from ChartFrame.)
ShapeProperties { get; }Gets the ShapeProperties object.(Inherited from ChartFrame.)
virtual TextFont { get; }(Obsolete.) Gets a Font object of the specified ChartFrame object.(Inherited from ChartFrame.)
virtual TextOptions { get; }Gets and sets the options of the text.(Inherited from ChartFrame.)
override Width { get; set; }Gets or sets the width of plot-area bounding box in units of 1/4000 of the chart area.
override X { get; set; }Gets or gets the x coordinate of the upper left corner of plot-area bounding box in units of 1/4000 of the chart area.
override Y { get; set; }Gets or gets the y coordinate of the upper top corner of plot-area bounding box in units of 1/4000 of the chart area.

Methods

NameDescription
override SetPositionAuto()Set position of the plot area to automatic

Examples

[C#]

namespace Demos
{
    using Aspose.Cells;
    using Aspose.Cells.Charts;
    using System;

    public class PlotAreaDemo
    {
        public static void PlotAreaExample()
        {
            // Create a new workbook
            Workbook workbook = new Workbook();
            Worksheet worksheet = workbook.Worksheets[0];

            // Add sample data
            worksheet.Cells[0, 0].PutValue("Category");
            worksheet.Cells[0, 1].PutValue("Value");
            worksheet.Cells[1, 0].PutValue("A");
            worksheet.Cells[1, 1].PutValue(10);
            worksheet.Cells[2, 0].PutValue("B");
            worksheet.Cells[2, 1].PutValue(20);
            worksheet.Cells[3, 0].PutValue("C");
            worksheet.Cells[3, 1].PutValue(30);

            // Add a chart to the worksheet
            int chartIndex = worksheet.Charts.Add(ChartType.Column, 5, 0, 15, 5);
            Chart chart = worksheet.Charts[chartIndex];

            // Set the data range for the chart
            chart.NSeries.Add("B2:B4", true);
            chart.NSeries.CategoryData = "A2:A4";

            // Access the plot area of the chart
            PlotArea plotArea = chart.PlotArea;

            // Set properties of the plot area
            plotArea.X = 100;
            plotArea.Y = 100;
            plotArea.Width = 3000;
            plotArea.Height = 2000;
            plotArea.InnerX = 200;
            plotArea.InnerY = 200;
            plotArea.InnerWidth = 2800;
            plotArea.InnerHeight = 1800;
            plotArea.IsAutomaticSize = false;
            plotArea.IsInnerMode = true;
            plotArea.AutoScaleFont = true;
            plotArea.BackgroundMode = BackgroundMode.Transparent;
            plotArea.Shadow = true;

            // Save the workbook
            workbook.Save("PlotAreaExample.xlsx");
        }
    }
}

See Also