Skip to main content

Surface3DSeries Class

A 3D surface series in a standard chart.

Declaration

public class Surface3DSeries extends SurfaceSeries

Remarks

Add Surface3DSeries objects to the Chart.getSeries() collection to create a 3D surface chart. The chart creates a Surface3DChartView object for the series.

Call the Chart.setView3D(value) method to rotate the chart and specify perspective.

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
JavaObject
See Also

Surface3DSeries()

Initializes a new instance of the Surface3DSeries class.

Declaration

public Surface3DSeries()