Displaying a Chart in 3D
Chart FX for Java allows you to generate charts in both 2D and 3D views. The Chart3D property of the Chart class allows developers to toggle charts between the 2D and 3D modes:
chart1.setChart3D(false); chart2.setChart3D(true);
|

Once a chart has been set to 3D, you can manipulate other visual attributes by utilizing properties such as Rotation, Cluster and Perspective.
Rotating the Chart Programmatically
Although Chart FX for Java provides end users with a User Interface for rotating charts, you may want to set 3D angles programmatically. You may use this option to rotate the chart on a real-time basis (with a timer) for presentation purposes.
To rotate a chart programmatically, you must combine the use of four different properties of the Chart class: Chart3D, View3D, AngleX and AngleY.
To rotate the chart programmatically, you must set both the Chart3D and View3D properties to "true". Once these are configured, you can set the 3D angle for the chart using the AngleX and AngleY properties.
Note: The AngleX property will accept values between [0,90] and [270,360], and the AngleY property will accept values between [0,360].
chart1.setChart3D(true); chart1.setView3D(true); chart1.setAngleX((short) 45); chart1.setAngleY((short) 60);
|
Setting 3D Wall Width
By default every 3D chart is enclosed in a 3D wall, and its width is controllable through the WallWidth property. The default width is 4 pixels. Configuring the AxesStyle property may also be used to modify the 3D wall. Setting the AxesStyle to ‘NONE’ will hide the 3D wall. You can also set the wall color with the InsideColor property.
chart1.setWallWidth((short) 10);
|

Clustered Charts
When displaying a clustered chart, each series will have its own position in the z-axis. This means, if you have a 3 series chart and this property is turned on, each data series will occupy one row of data and there will be 3 rows (z-axis clusters) in the chart. To make a 3D chart clustered use the Cluster property as follows:

Note: Area charts are always clustered, as there is no way to paint different series side by side. On the other hand, if you have a Bar chart, it is possible to paint bars side-by-side and not clustered in the z-axis.
Setting the Chart Perspective
The perspective value specifies the ratio of the front of the chart to the back of the chart. It ranges from 0 (default) degrees to 100 degrees. The Perspective property allows you to control this ratio and give your charts a custom perspective. For example to set a perspective of 50%, you need to set the Perspective property as follows:
chart1.setPerspective((short) 50);
|
Important Note: In order to apply a perspective correctly, the chart must be in 3D (Chart3D property) and both the View3D and Cluster properties must be set to "true".
Controlling the 3D Depth
The View3DDepth property allows you to control the depth of a chart. You must set the Chart to 3D mode using the Chart3D property in order for the View3DDepth settings to apply. The value is a percentage of the marker's width (the distance between two consecutive points in the X-axis).
For example:
100% means the marker will have a depth equal to its width.
200% means the marker will have a depth double its width.
chart1.setChart3D(true); chart1.setView3DDepth(200);
|
Here is a chart with the View3DDepth property set to 200:

|