XYDiagramPaneCollection Class
Represents a collection of panes to be shown in a chart’s diagram.
Namespace: DevExpress.XtraCharts
Assembly: DevExpress.XtraCharts.v24.2.dll
Declaration
Related API Members
The following members return XYDiagramPaneCollection objects:
Remarks
The XYDiagramPaneCollection class implements all the panes collection functionality used to manipulate panes within a chart control. Members available via the XYDiagramPaneCollection class allow you to add, delete, access individual panes and perform other common collection management tasks. Individual pane items can be accessed using indexer notation.
An instance of the XYDiagramPaneCollection class can be accessed via the XYDiagram2D.Panes property of a chart.
For more information, refer to Panes.
Example
This example demonstrates how to display a chart’s series in separate panes.
For this example to work correctly, do the following.
- Start MS Visual Studio, and create a new Windows Forms Application, or open an existing one.
- Include all necessary assemblies to the References list of your project.
Open the Solution Explorer window (e.g. by pressing CTRL+ALT+L), right-click the WindowsApplication1 item and in the invoked menu, point to Add and click Existing Item…. Then, locate the gsp.mdb file (it is shipped with XtraCharts suite and located in the directory, where you installed DevExpress demos) and click Add. In the displayed dialog, select the GSP table of this database.
A dataset (named gspDataSet) is automatically created after performing the above steps.
- Drop a button onto the form and add the following code to the Button1.Click event handler.
using System;
using DevExpress.XtraCharts;
using DevExpress.XtraEditors;
namespace TwoBoundSeriesInPanes {
public partial class MainForm : XtraForm {
public MainForm() {
InitializeComponent();
// This line of code is generated by Data Source Configuration Wizard
gspTableAdapter.Fill(gspDataSet.GSP);
}
private void OnFormLoad(object sender, EventArgs e) {
Series year2003Series = new Series();
year2003Series.Name = "2003";
year2003Series.ArgumentDataMember = "Region";
year2003Series.ValueDataMembers[0] = "GSP";
year2003Series.FilterString = @"[Year] == 2003";
Series year2004Series = new Series();
year2004Series.Name = "2004";
year2004Series.ArgumentDataMember = "Region";
year2004Series.ValueDataMembers[0] = "GSP";
year2004Series.FilterString = @"[Year] == 2004";
chartControl.Series.AddRange(year2003Series, year2004Series);
XYDiagram diagram = (XYDiagram)chartControl.Diagram;
XYDiagramPane secondPane = new XYDiagramPane("Second Pane");
diagram.Panes.Add(secondPane);
Legend secondLegend = new Legend("Second Legend") {
DockTarget = secondPane,
AlignmentHorizontal = LegendAlignmentHorizontal.Right,
AlignmentVertical = LegendAlignmentVertical.Top
};
chartControl.Legends.Add(secondLegend);
XYDiagramSeriesViewBase xyView = (XYDiagramSeriesViewBase)year2004Series.View;
year2004Series.Legend = secondLegend;
xyView.Pane = secondPane;
}
}
}