Share via

3D Charts

The Chart control supports 3D charts. To use 3D charts, set the respective chart area's Area3DStyle.Enable3D property to True.

3D Properties

The following picture shows how the properties in ChartArea.Area3DStyle correspond to the appearance of the 3D chart area.

In addition to the properties shown, the Area3DStyle.Perspective property gives the chart area a spatial perspective. Setting this property to a higher value makes the chart area appear closer to the reader.

When you set the Area3DStyle.IsRightAngleAxis property to True, the vertical axis always appears at a right angle to the horizontal or the Z axis, depending on the degree of rotation. When this property is set to True, the Area3DStyle.Perspective property has no effect. The same is true conversely.

Effects on Chart Elements

Using 3D for a chart area can affect chart elements behave in the chart area in the following ways:

  • The depths of annotations displayed in a 3D-enabled chart area cannot be changed. Annotations that are anchored to a data point have the same depth as the data point they are anchored to. In all other cases, annotations are displayed on the front surface of the 3D chart area.

  • Annotations cannot be anchored to data points in 3D pie or doughnut charts.

  • Scrolling and zooming is not available.

  • Scale breaks is not available.

Custom Drawing and 3D

Unlike in 2D chart areas, the Chart control does not raise the PrePaint or PostPaint events for series and data points in 3D chart areas. You must use other events to perform custom drawing.

Because 3D chart areas have an (X,Y,Z) coordinate system, you must transform between the (X,Y) coordinates used by the GDI+ methods and (X,Y,Z) coordinates. For example, to get the absolute pixel coordinates of a point on the 3D axis, do the following steps:

  1. Use the Axis.ValueToPosition method to get the relative X and Y coordinate values from the axis values.

  2. Use the ChartArea.GetSeriesZPosition and ChartArea.GetSeriesDepth methods to get the relative Z coordinate value.

  3. Use the Point3D class to instantiate a Point3D object with the X, Y, and Z coordinate values.

  4. Use the ChartArea.TransformPoints method to transform the relative (X,Y,Z) coordinates to 2D relative coordinates.

  5. Use the ChartGraphics.GetAbsolutePoint method to convert the relative coordinates to absolute pixel coordinates.

See Also




Other Resources

Using Chart Controls