Skip to main content

DataPointEx Class

Contains custom appearance settings for an individual data point in a chart of a type introduced in Microsoft Excel 2016.

Declaration

public class DataPointEx extends ChartElement

Remarks

To customize an individual data point, call the SeriesExBase.getCustomDataPoints() method and add a DataPointEx object to the returned IDataPointExDictionary. The dictionary key is the zero-based data point index.

Call DataPointEx.setFill(value), DataPointEx.setOutlineStyle(value), and DataPointEx.setEffects(value) methods to specify the fill, outline, and shape effects of the data point.

Refer to the following help topic for additional information: Create Waterfall, Funnel, Treemap, and Other Office 2016 Charts — Presentation API for Java.

Example

Fill an Individual Data Point in a Funnel Chart

The following code snippet creates a funnel chart and fills the last data point with red color:

import java.io.*;
import java.nio.file.*;
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 {
        String[] stages = { "Leads", "Qualified", "Proposals", "Negotiations", "Deals" };
        double[] counts = { 1200, 640, 310, 150, 70 };

        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.
            ChartEx chart = new ChartEx();
            chart.setWidth(presentation.getSlideSize().getWidth());
            chart.setHeight(presentation.getSlideSize().getHeight());
            slide.getShapes().add(chart);

            // Add stages and counts to chart data cells.
            ChartData data = chart.getData();
            for (int i = 0; i < stages.length; i++) {
                data.get(0, "A" + (i + 1)).setTextValue(stages[i]);
                data.get(0, "B" + (i + 1)).setNumericValue(counts[i]);
            }

            // Create a funnel series.
            FunnelSeries series = new FunnelSeries();
            series.setText("Sales Pipeline");
            series.setArguments(new ChartDataReference(0, "A1", "A5"));
            series.setValues(new ChartDataReference(0, "B1", "B5"));
            chart.getSeries().add(series);

            // Fill the last data point with red.
            DataPointEx point = new DataPointEx();
            point.setFill(new SolidFill(Color.getRed()));
            series.getCustomDataPoints().put(4, point);

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

 Funnel chart with the last data point filled with red 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.initFields()
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

DataPointEx()

Initializes a new instance of the DataPointEx class.

Declaration

public DataPointEx()

Methods

deepClone() Method

Returns a deep copy of this DataPointEx instance.

Declaration

public DataPointEx deepClone()

Returns

Type Description
DataPointEx

A deep copy of this DataPointEx.