Tutorial 15 - Chart 3D
Contents
Chart display modes (3D) Chart Editor page
2D Chart
3D Orthogonal Chart
3D "Native" Windows Chart
Chart display modes
(3D) Chart Editor page You may define the major 2D/3D display options with the Chart Editor at design time.

2D Chart
The 2D Chart may be selected at design time using the Chart Editor. Deselecting the 3D checkbox on the Editor page puts the Chart in 2D mode. At runtime you can change the Chart to 2D at any time with:
[C#]
tChart1.Aspect.View3D = false;
[VB.Net]
TChart1.Aspect.View3D = False
Working with the 2D Chart presents no special issues. All object co-ordinates are positions relative to the Chart panel or Chart rectangle, there is no need to make any allowance for 3D offset (see following sections).
3D Orthogonal Chart
3D Orthogonal mode is the default way to obtain 3D 'effect'. TeeChart draws a depth effect at an orthogonal angle according to the TChart1.Aspect.Chart3DPercent property setting (also available at design time on the Chart Editor page). You cannot rotate a 3D Orthogonal Chart, the Bottom Axis is always horizontal.
When working with 3D orthogonal Charts you will need to take into account the Width3D and Height3D 3D offset when custom drawing to the Canvas. If you wish an item to be drawn to be flush with the Chart Backwall you should add the offset. See the following examples:
This example draws a diagonal line across the Chart flush to the Front of the Chart:
[C#]
private void tChart1_AfterDraw(object sender, Steema.TeeChart.Drawing.Graphics3D g) {
Point p1 = new Point(tChart1.Axes.Left.Position, tChart1.Axes.Top.Position);
Point p2 = new Point(tChart1.Axes.Right.Position, tChart1.Axes.Bottom.Position);
g.MoveTo(p1);
g.LineTo(p2, 0);
}
[VB.Net]
Private Sub TChart1_AfterDraw(ByVal sender As Object, ByVal g As Steema.TeeChart.Drawing.Graphics3D) Handles TChart1.AfterDraw
Dim P1 As New Point(TChart1.Axes.Left.Position, TChart1.Axes.Top.Position)
Dim P2 As New Point(TChart1.Axes.Right.Position, TChart1.Axes.Bottom.Position)
g.MoveTo(P1)
g.LineTo(P2, 0)
End Sub
This example draws a diagonal line across the Chart flush to the Back of the Chart
[C#]
private void tChart1_AfterDraw(object sender, Steema.TeeChart.Drawing.Graphics3D g) {
int width3D = tChart1.Aspect.Width3D;
Point p1 = new Point(tChart1.Axes.Left.Position, tChart1.Axes.Top.Position);
Point p2 = new Point(tChart1.Axes.Right.Position, tChart1.Axes.Bottom.Position);
g.MoveTo(p1, width3D);
g.LineTo(p2, width3D);
}
[VB.Net]
Private Sub TChart1_AfterDraw(ByVal sender As Object, ByVal g As Steema.TeeChart.Drawing.Graphics3D) Handles TChart1.AfterDraw
Dim Width3D As Integer = TChart1.Aspect.Width3D
Dim P1 As New Point(TChart1.Axes.Left.Position, TChart1.Axes.Top.Position)
Dim P2 As New Point(TChart1.Axes.Right.Position, TChart1.Axes.Bottom.Position)
g.MoveTo(P1, Width3D)
g.LineTo(P2, Width3D)
End Sub
Use the Aspect interface when working with display properties for 3D Charts at runtime (*Note. Not all options are available for Orthogonal Charts).
3D "Native" Windows Chart
Native Windows mode 3D offers Chart rotation and elevation through 90°. You may Zoom in and out on the overall Chart (Zoom within the Chart is available too, see the Zoom/Scroll tutorial).
Select Native Windows mode 3D for TeeChart at design time by deselecting the Orthogonal checkbox on the 3D Editor page.
[C#]
tChart1.Aspect.Orthogonal = false;
[VB.Net]
TChart1.Aspect.Orthogonal = False
In the Chart Editor, disactivating Orthogonal will simultaneously activate the slide bars for Elevation and Rotation allowing design time changes for these display properties.
For a closer look at the definition of the TeeChart Canvases look at the Custom drawing tutorial.

