View3DOptions Class
Contains 3D view settings for a chart.
Declaration
public class View3DOptions extends OfficeObject
Remarks
To specify 3D view settings, pass a View3DOptions object to the Chart.setView3D(value) method. The chart applies 3D view settings when it displays 3D series (for example, Bar3DSeries).
Refer to the following help topic for additional information: Create Standard Charts — Presentation API for Java.
Example
Rotate a 3D Chart and Fill the Floor and Back Wall
The following code snippet creates a 3D bar chart, specifies rotation, perspective, and depth, and fills the chart floor and back wall:
import java.io.*;
import java.nio.file.*;
import java.util.List;
import com.devexpress.docs.office.*;
import com.devexpress.docs.presentation.*;
import com.devexpress.system.drawing.*;
public class Main {
public static void main(String[] args) throws Exception {
try (Presentation presentation = new Presentation()) {
// Add a blank slide.
presentation.getSlides().clear();
Slide slide = new Slide(SlideLayoutType.BLANK);
presentation.getSlides().add(slide);
// Insert a chart that fills the slide.
Chart chart = new Chart();
chart.setWidth(presentation.getSlideSize().getWidth());
chart.setHeight(presentation.getSlideSize().getHeight());
slide.getShapes().add(chart);
// Add a 3D bar series.
Bar3DSeries series = new Bar3DSeries();
series.setArguments(new ChartStringData(List.of("Q1", "Q2", "Q3", "Q4")));
series.setValues(new ChartNumericData(List.of(12.0, 18.0, 15.0, 21.0)));
chart.getSeries().add(series);
// Rotate the chart and specify perspective and depth.
View3DOptions view3D = new View3DOptions();
view3D.setXRotation(20);
view3D.setYRotation(40);
view3D.setPerspective(60);
view3D.setDepthPercent(2f);
// Fill the floor and back wall.
SurfaceOptions floor = new SurfaceOptions();
floor.setFill(new SolidFill(Color.getLightGray()));
view3D.setFloor(floor);
SurfaceOptions backWall = new SurfaceOptions();
backWall.setFill(new SolidFill(Color.getAliceBlue()));
view3D.setBackWall(backWall);
chart.setView3D(view3D);
// Save the presentation.
Files.createDirectories(Path.of("output"));
try (OutputStream output = Files.newOutputStream(Path.of("output", "Chart.pptx"))) {
presentation.save(output);
}
}
}
}
The following screenshot illustrates the result:

Inherited Members
Inheritance
View3DOptions()
Initializes a new instance of the View3DOptions class.
Declaration
public View3DOptions()
Methods
deepClone() Method
Creates a copy of the 3D view settings.
Declaration
public View3DOptions deepClone()
Returns
| Type | Description |
|---|---|
View3DOptions |
A copy of the 3D view settings. |
getAutoHeight() Method
Returns whether the API calculates the height of a 3D chart automatically.
Declaration
public boolean getAutoHeight()
Returns
| Type | Description |
|---|---|
| boolean |
|
getBackWall() Method
Returns settings for the back wall of a 3D chart.
Declaration
public SurfaceOptions getBackWall()
Returns
| Type | Description |
|---|---|
| SurfaceOptions | Settings for the back wall, or |
getDepthPercent() Method
Returns the depth of a 3D chart as a percentage factor.
Declaration
public float getDepthPercent()
Returns
| Type | Description |
|---|---|
| float | The depth factor ( |
getFloor() Method
Returns settings for the floor of a 3D chart.
Declaration
public SurfaceOptions getFloor()
Returns
| Type | Description |
|---|---|
| SurfaceOptions | Settings for the floor, or |
getHeightPercent() Method
Returns the height of a 3D chart as a percentage factor.
Declaration
public float getHeightPercent()
Returns
| Type | Description |
|---|---|
| float | The height factor ( |
getPerspective() Method
Returns the perspective angle of a 3D chart.
Declaration
public int getPerspective()
Returns
| Type | Description |
|---|---|
| int | The perspective angle. |
getRightAngleAxes() Method
Returns whether a 3D chart uses right-angle axes.
Declaration
public boolean getRightAngleAxes()
Returns
| Type | Description |
|---|---|
| boolean |
|
getSideWall() Method
Returns settings for the side wall of a 3D chart.
Declaration
public SurfaceOptions getSideWall()
Returns
| Type | Description |
|---|---|
| SurfaceOptions | Settings for the side wall, or |
getXRotation() Method
Returns the rotation of a 3D chart around the x-axis.
Declaration
public int getXRotation()
Returns
| Type | Description |
|---|---|
| int | The rotation angle in degrees. |
getYRotation() Method
Returns the rotation of a 3D chart around the y-axis.
Declaration
public int getYRotation()
Returns
| Type | Description |
|---|---|
| int | The rotation angle in degrees. |
setAutoHeight(boolean value) Method
Sets whether the API calculates the height of a 3D chart automatically.
Declaration
public void setAutoHeight(boolean value)
Parameters
| Name | Type | Description |
|---|---|---|
| value | boolean |
|
Remarks
A new View3DOptions object does not calculate the height automatically and uses the setHeightPercent(float value) value.
setBackWall(SurfaceOptions value) Method
Sets settings for the back wall of a 3D chart.
Declaration
public void setBackWall(SurfaceOptions value)
Parameters
| Name | Type | Description |
|---|---|---|
| value | SurfaceOptions | Settings for the back wall, or |
setDepthPercent(float value) Method
Sets the depth of a 3D chart as a percentage factor.
Declaration
public void setDepthPercent(float value)
Parameters
| Name | Type | Description |
|---|---|---|
| value | float | The depth factor ( |
Exceptions
| Type | Description |
|---|---|
| ArgumentOutOfRangeException | Thrown if the |
Remarks
The value range is from 0.2 to 20. A new View3DOptions object uses 1.
setFloor(SurfaceOptions value) Method
Sets settings for the floor of a 3D chart.
Declaration
public void setFloor(SurfaceOptions value)
Parameters
| Name | Type | Description |
|---|---|---|
| value | SurfaceOptions | Settings for the floor, or |
setHeightPercent(float value) Method
Sets the height of a 3D chart as a percentage factor.
Declaration
public void setHeightPercent(float value)
Parameters
| Name | Type | Description |
|---|---|---|
| value | float | The height factor ( |
Exceptions
| Type | Description |
|---|---|
| ArgumentOutOfRangeException | Thrown if the |
Remarks
The value range is from 0.05 to 5. A new View3DOptions object uses 1.
setPerspective(int value) Method
Sets the perspective angle of a 3D chart.
Declaration
public void setPerspective(int value)
Parameters
| Name | Type | Description |
|---|---|---|
| value | int | The perspective angle. |
Exceptions
| Type | Description |
|---|---|
| ArgumentOutOfRangeException | Thrown if the |
Remarks
The value range is from 0 to 240. A new View3DOptions object uses 30.
setRightAngleAxes(boolean value) Method
Sets whether a 3D chart uses right-angle axes.
Declaration
public void setRightAngleAxes(boolean value)
Parameters
| Name | Type | Description |
|---|---|---|
| value | boolean |
|
Remarks
A new View3DOptions object does not use right-angle axes.
setSideWall(SurfaceOptions value) Method
Sets settings for the side wall of a 3D chart.
Declaration
public void setSideWall(SurfaceOptions value)
Parameters
| Name | Type | Description |
|---|---|---|
| value | SurfaceOptions | Settings for the side wall, or |
setXRotation(int value) Method
Sets the rotation of a 3D chart around the x-axis.
Declaration
public void setXRotation(int value)
Parameters
| Name | Type | Description |
|---|---|---|
| value | int | The rotation angle in degrees. |
Exceptions
| Type | Description |
|---|---|
| ArgumentOutOfRangeException | Thrown if the |
Remarks
The value range is from -90 to 90. A new View3DOptions object uses 0.
setYRotation(int value) Method
Sets the rotation of a 3D chart around the y-axis.
Declaration
public void setYRotation(int value)
Parameters
| Name | Type | Description |
|---|---|---|
| value | int | The rotation angle in degrees. |
Exceptions
| Type | Description |
|---|---|
| ArgumentOutOfRangeException | Thrown if the |
Remarks
The value range is from 0 to 360. A new View3DOptions object uses 0.