Skip to main content

Surface3DChartView Class

Contains settings that apply to 3D surface series in a chart view.

Declaration

public class Surface3DChartView extends SurfaceChartViewBase

Remarks

When you add a Surface3DSeries object to a chart, the chart creates a Surface3DChartView object for the series. Call the Chart.getViews() method to access chart views.

If the chart has no 3D view settings, the chart also creates a View3DOptions object with an X rotation of 15, a Y rotation of 20, and a perspective of 30. Call the Chart.setView3D(value) method to rotate the chart and specify perspective.

Call the Surface3DChartView.setDisplayAsWireframe(value) method to display the surface as a wireframe. Call the Surface3DChartView.getBandFormats() method to access formatting settings for surface bands.

Refer to the following help topic for additional information: Create Standard Charts — Presentation API for Java.

Example

Create a 3D Surface Chart

The following code snippet creates a 3D surface chart with four series and rotates the chart:

import java.io.*;
import java.nio.file.*;
import java.util.List;
import com.devexpress.docs.office.*;
import com.devexpress.docs.presentation.*;

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 surface series for each depth row.
            String[] names = { "Row 1", "Row 2", "Row 3", "Row 4" };
            double[][] values = {
                { 10, 25, 30, 20, 15 },
                { 20, 40, 55, 35, 25 },
                { 15, 35, 45, 40, 20 },
                { 5, 15, 25, 20, 10 }
            };
            for (int i = 0; i < names.length; i++) {
                Surface3DSeries series = new Surface3DSeries();
                series.setText(names[i]);
                series.setArguments(new ChartStringData(List.of("A", "B", "C", "D", "E")));
                series.setValues(new ChartNumericData(List.of(values[i][0], values[i][1], values[i][2], values[i][3], values[i][4])));
                chart.getSeries().add(series);
            }

            // Rotate the chart.
            View3DOptions view3D = new View3DOptions();
            view3D.setXRotation(25);
            view3D.setYRotation(40);
            chart.setView3D(view3D);

            // Save the presentation.
            Files.createDirectories(Path.of("output"));
            try (OutputStream output = Files.newOutputStream(Path.of("output", "Chart.pptx"))) {
                presentation.save(output);
            }
        }
    }
}

Inherited Members

com.devexpress.system.JavaObject.clone()
com.devexpress.system.JavaObject.equals(java.lang.Object)
com.devexpress.system.JavaObject.hashCode()
com.devexpress.system.JavaObject.memberwiseClone()
com.devexpress.system.JavaObject.toString()
java.lang.Object.finalize()
java.lang.Object.getClass()
java.lang.Object.notify()
java.lang.Object.notifyAll()
java.lang.Object.wait()
java.lang.Object.wait(long)
java.lang.Object.wait(long,int)

Inheritance

Object
See Also

Surface3DChartView()

Initializes a new instance of the Surface3DChartView class.

Declaration

public Surface3DChartView()

Methods

getChartType() Method

Returns the chart type of the view.

Declaration

public ChartType getChartType()

Returns

Type Description
ChartType

ChartType.SURFACE_3_D.