Back to Devexpress

ChartObject.PlotArea Property

officefileapi-devexpress-dot-spreadsheet-dot-charts-dot-chartobject-60438120.md

latest4.2 KB
Original Source

ChartObject.PlotArea Property

Provides access to the chart’s plot area.

Namespace : DevExpress.Spreadsheet.Charts

Assembly : DevExpress.Spreadsheet.v25.2.Core.dll

NuGet Package : DevExpress.Spreadsheet.Core

Declaration

csharp
PlotArea PlotArea { get; }
vb
ReadOnly Property PlotArea As PlotArea

Property Value

TypeDescription
PlotArea

A PlotArea object that is the chart’s plot area.

|

Remarks

The example below demonstrates how to create a transparent chart with a semi-transparent plot area.

View Example

csharp
Worksheet worksheet = workbook.Worksheets["chartTask4"];
workbook.Worksheets.ActiveWorksheet = worksheet;

// Create a chart and specify its location.
Chart chart = worksheet.Charts.Add(ChartType.Line, worksheet["B3:D8"]);
chart.TopLeftCell = worksheet.Cells["F3"];
chart.BottomRightCell = worksheet.Cells["L14"];

// Customize the chart area and the plot area appearance.
chart.Fill.SetNoFill();
chart.Outline.SetSolidFill(Color.FromArgb(0x99, 0x99, 0x99));
chart.PlotArea.Fill.SetSolidFill(Color.FromArgb(0x22, 0x99, 0x99, 0x99));

// Specify the position of the legend.
chart.Legend.Position = LegendPosition.Top;

// Use a secondary axis.
chart.Series[1].AxisGroup = AxisGroup.Secondary;

// Customize the axis scale and appearance.
Axis axis = chart.PrimaryAxes[0];
axis.Outline.SetNoFill();
axis.MajorTickMarks = AxisTickMarks.None;

axis = chart.PrimaryAxes[1];
axis.Outline.SetNoFill();
axis.MajorTickMarks = AxisTickMarks.None;
axis.MajorGridlines.Visible = false;
axis.Scaling.AutoMax = false;
axis.Scaling.AutoMin = false;
axis.Scaling.Max = 1400;
axis.Scaling.Min = 0;

axis = chart.SecondaryAxes[1];
axis.Outline.SetNoFill();
axis.MajorTickMarks = AxisTickMarks.None;
axis.Scaling.AutoMax = false;
axis.Scaling.AutoMin = false;
axis.Scaling.Max = 390;
axis.Scaling.Min = 270;
vb
Dim worksheet As Worksheet = workbook.Worksheets("chartTask4")
workbook.Worksheets.ActiveWorksheet = worksheet

' Create a chart and specify its location.
Dim chart As Chart = worksheet.Charts.Add(ChartType.Line, worksheet("B3:D8"))
chart.TopLeftCell = worksheet.Cells("F3")
chart.BottomRightCell = worksheet.Cells("L14")

' Customize the chart area and the plot area appearance.
chart.Fill.SetNoFill()
chart.Outline.SetSolidFill(Color.FromArgb(&H99, &H99, &H99))
chart.PlotArea.Fill.SetSolidFill(Color.FromArgb(&H22, &H99, &H99, &H99))

' Specify the position of the legend.
chart.Legend.Position = LegendPosition.Top

' Use a secondary axis.
chart.Series(1).AxisGroup = AxisGroup.Secondary

' Customize the axis scale and appearance.
Dim axis As Axis = chart.PrimaryAxes(0)
axis.Outline.SetNoFill()
axis.MajorTickMarks = AxisTickMarks.None

axis = chart.PrimaryAxes(1)
axis.Outline.SetNoFill()
axis.MajorTickMarks = AxisTickMarks.None
axis.MajorGridlines.Visible = False
axis.Scaling.AutoMax = False
axis.Scaling.AutoMin = False
axis.Scaling.Max = 1400
axis.Scaling.Min = 0

axis = chart.SecondaryAxes(1)
axis.Outline.SetNoFill()
axis.MajorTickMarks = AxisTickMarks.None
axis.Scaling.AutoMax = False
axis.Scaling.AutoMin = False
axis.Scaling.Max = 390
axis.Scaling.Min = 270

See Also

Spreadsheet Charts

ChartObject Interface

ChartObject Members

DevExpress.Spreadsheet.Charts Namespace