Skip to main content

Line3DDataLabel Class

Contains settings for a data label in a 3D line chart.

Declaration

public class Line3DDataLabel extends DataLabel

Remarks

The Line3DDataLabel class inherits label content and formatting settings from DataLabel and DataLabelBase classes (for example, Line3DDataLabel.setShowValue(value) and Line3DDataLabel.setCustomText(value) methods).

To format the data label of an individual data point, pass a Line3DDataLabel object to the ILine3DDataLabels.setLabel(key, value) method.

Refer to the following help topic for additional information: Customize Chart Data Labels — Presentation API for Java.

Example

Create a 3D Line Chart

The following code snippet creates a 3D line chart with two series, rotates the chart, increases the depth gap between series, and displays a data label for one data point:

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 two 3D line series.
            String[] names = { "Online", "Retail" };
            double[][] values = { { 12, 18, 15, 21 }, { 9, 11, 14, 13 } };
            for (int i = 0; i < names.length; i++) {
                Line3DSeries series = new Line3DSeries();
                series.setText(names[i]);
                series.setArguments(new ChartStringData(List.of("Q1", "Q2", "Q3", "Q4")));
                series.setValues(new ChartNumericData(List.of(values[i][0], values[i][1], values[i][2], values[i][3])));
                chart.getSeries().add(series);
            }

            // Increase the depth gap between series.
            Line3DChartView view = (Line3DChartView) chart.getViews().get(0);
            view.setGapDepth(250);

            // Rotate the chart.
            View3DOptions view3D = new View3DOptions();
            view3D.setXRotation(20);
            view3D.setYRotation(30);
            chart.setView3D(view3D);

            // Display the Q4 value of the first series.
            Line3DDataLabel label = new Line3DDataLabel();
            label.setShowValue(true);
            Line3DSeries firstSeries = (Line3DSeries) chart.getSeries().get(0);
            firstSeries.getDataLabels().setLabel(3, label);

            // 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:

 3D line chart with two series and a data label created with the DevExpress Presentation API for Java

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

Line3DDataLabel()

Initializes a new instance of the Line3DDataLabel class.

Declaration

public Line3DDataLabel()

Methods

deepClone() Method

Returns a deep copy of this Line3DDataLabel instance.

Declaration

public Line3DDataLabel deepClone()

Returns

Type Description
Line3DDataLabel

A deep copy of this Line3DDataLabel.