Every Chart contains one or more PlotAreas. The PlotArea is the object that actually contains the series (one or more series). The PlotArea is the actual area within the bounds of the Chart where the series will be plotted. By default, every Chart contains a PrimaryPlotArea and every PlotArea (including the PrimaryPlotArea) contains a X and Y axes. In many cases, a Chart can be created and the DefaultChartArea can begin having series added to it. Usually, only more advanced charts would need multiple PlotAreas in the same Chart.
If the Chart's AutoLayout property is set to True (by default it is) the PlotAreas in that Chart will be laid out automatically. In other words, when the AutoLayout property is set to True, the PlotAreas inside that Chart will have their X, Y, Height and Width properties automatically determined and set so that all PlotAreas are aligned vertically. If manual control over the PlotArea's layout is desired, then the Chart's AutoLayout property should be set to False. The Chart's Layout method should be called and then the PlotArea's properties (X, Y, Height and Width) can be manually set.
To get the default plot area from the chart the following code can be used.
Chart chart = new Chart(0, 0, 400, 200); PlotArea plotArea = chart.PrimaryPlotArea;
Dim MyChart As New Chart(0, 0, 400, 200) Dim MyPlotArea As PlotArea = MyChart.PrimaryPlotArea
To create a new plot area the following code can be used.
Chart chart = new Chart(0, 0, 700, 400); PlotArea plotArea = chart.PlotAreas.Add(50, 50, 300, 300);
Dim MyChart = New Chart(0, 0, 700, 400) Dim MyPlotArea As PlotArea = MyChart.PlotAreas.Add(50, 50, 300, 300)