A newer version of this page is available. Switch to the current version.

XYDiagramPaneBase.SizeMode Property

Obsolete. Gets or sets a value indicating whether a pane's size should be fixed, or changed when a chart is resized.

Namespace: DevExpress.XtraCharts

Assembly: DevExpress.XtraCharts.v18.2.dll

Declaration

[Obsolete("This property is obsolete now. Use the Diagram.PaneLayout.RowDefinitions or Diagram.PaneLayout.ColumnDefinitions property to specify the pane's Measurement Unit. Refer to the http://docs.devexpress.com/WindowsForms/5881 page for more information about the new layout system.")]
[Browsable(false)]
[XtraSerializableProperty]
public PaneSizeMode SizeMode { get; set; }
<Obsolete("This property is obsolete now. Use the Diagram.PaneLayout.RowDefinitions or Diagram.PaneLayout.ColumnDefinitions property to specify the pane's Measurement Unit. Refer to the http://docs.devexpress.com/WindowsForms/5881 page for more information about the new layout system.")>
<Browsable(False)>
<XtraSerializableProperty>
Public Property SizeMode As PaneSizeMode

Property Value

Type Description
PaneSizeMode

A PaneSizeMode object which represents the pane's size mode.

Remarks

When the SizeMode property is set to UseWeight, the size of a pane is defined via its XYDiagramPaneBase.Weight property.

When the SizeMode property is set to UseSizeInPixels, the size of a pane is defined via its XYDiagramPaneBase.SizeInPixels property.

NOTE

Because the sum of all pane sizes may exceed the available space, an increase in one pane's XYDiagramPaneBase.SizeInPixels property causes all panes with a fixed size to decrease, to fit into the chart's area. If the aggregate of all panes' sizes is greater than the chart's width, panes' dimensions are proportionally decreased.

If you use the default values for the default pane (its XYDiagramPaneBase.SizeMode property is set to UseWeight), you can provide a custom size for secondary panes (XYDiagramPaneBase.SizeMode is set to UseSizeInPixels). In this scenario, the size of secondary panes will be fixed, unless the default pane size becomes zero.

The following images demonstrate the behavior of a chart's panes with different SizeMode property values, when the chart is resized.

ChartControl.Width = 350
SizeMode_Small
ChartControl.Width = 450
SizeMode_Large

For more information, refer to Panes.

Examples

This example demonstrates how panes can be accessed and customized at runtime.

Assuming that there are two series of the line view type in the chart, in the following code, we create an additional pane, and assign the second series to it. In addition, a secondary axis is created and assigned to that series, and it is also visible in the additional pane.

using System;
using System.Drawing;
using System.Windows.Forms;
using DevExpress.XtraCharts;
// ...

private void Form1_Load(object sender, EventArgs e) {
    // Create a new chart.
    ChartControl chartControl1 = new ChartControl();

    // Create two series.
    Series series1 = new Series("Series 1", ViewType.Bar);
    Series series2 = new Series("Series 2", ViewType.Line);

    // Add points to them, with their arguments different.
    series1.Points.Add(new SeriesPoint("A", 10));
    series1.Points.Add(new SeriesPoint("B", 12));
    series1.Points.Add(new SeriesPoint("C", 17));
    series1.Points.Add(new SeriesPoint("D", 14));
    series2.Points.Add(new SeriesPoint("I", 2500));
    series2.Points.Add(new SeriesPoint("II", 3800));
    series2.Points.Add(new SeriesPoint("III", 1500));
    series2.Points.Add(new SeriesPoint("IV", 1300));

    // Add both series to the chart.
    chartControl1.Series.AddRange(new Series[] { series1, series2 });

    // Hide the legend (optional).
    chartControl1.Legend.Visible = false;

    // Cast the chart's diagram to the XYDiagram type, 
    // to access its axes and panes.
    XYDiagram diagram = (XYDiagram)chartControl1.Diagram;

    // Add secondary axes to the diagram, and adjust their options.
    diagram.SecondaryAxesX.Add(new SecondaryAxisX("My Axis X"));
    diagram.SecondaryAxesY.Add(new SecondaryAxisY("My Axis Y"));
    diagram.SecondaryAxesX[0].Alignment = AxisAlignment.Near;
    diagram.SecondaryAxesY[0].Alignment = AxisAlignment.Near;

    // Add a new additional pane to the diagram.
    diagram.Panes.Add(new XYDiagramPane("My Pane"));

    // Assign both the additional pane and, if required,
    // the secondary axes to the second series. 
    LineSeriesView myView = (LineSeriesView)series2.View;
    myView.AxisX = diagram.SecondaryAxesX[0];
    myView.AxisY = diagram.SecondaryAxesY[0];
    // Note that the created pane has the zero index in the collection,
    // because the existing Default pane is a separate entity.
    myView.Pane = diagram.Panes[0];

    // Customize the layout of the diagram's panes.
    diagram.PaneDistance = 10;
    diagram.PaneLayoutDirection = PaneLayoutDirection.Horizontal;
    diagram.DefaultPane.SizeMode = PaneSizeMode.UseWeight;
    diagram.DefaultPane.Weight = 1.2;

    // Add the chart to the form.
    chartControl1.Dock = DockStyle.Fill;
    this.Controls.Add(chartControl1);
}
See Also