Skip to main content

FunnelSeries Class

A series in a funnel chart.

Declaration

public class FunnelSeries extends DataSeriesExBase

Remarks

Add a FunnelSeries object to the ChartEx.getSeries() collection to create a funnel chart.

A funnel chart displays values as centered horizontal bars. The bar width is proportional to the value. Funnel charts usually display stages of a process (for example, a sales pipeline).

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

Example

Create a Funnel Chart with Data Labels

The following code snippet creates a funnel chart, displays values in data labels, and applies bold text formatting to the last data label:

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

            // Create a funnel series and specify sales pipeline stages.
            FunnelSeries series = new FunnelSeries();
            series.setText("Sales Pipeline");
            series.setArguments(new ChartStringData(List.of("Leads", "Qualified", "Proposals", "Negotiations", "Deals")));
            series.setValues(new ChartNumericData(List.of(1200.0, 640.0, 310.0, 150.0, 85.0)));
            chart.getSeries().add(series);

            // Display values in data labels.
            TextProperties labelText = new TextProperties();
            labelText.setFontSize(20f);
            series.getDataLabels().setShowValue(true);
            series.getDataLabels().setTextProperties(labelText);

            // Apply bold text formatting to the data label of the last stage.
            TextProperties boldText = new TextProperties();
            boldText.setFontSize(20f);
            boldText.setBold(true);
            FunnelDataLabel lastLabel = new FunnelDataLabel();
            lastLabel.setShowValue(true);
            lastLabel.setTextProperties(boldText);
            series.getDataLabels().setLabel(4, lastLabel);

            // 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 a bold data label for the last stage 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
See Also

FunnelSeries()

Initializes a new instance of the FunnelSeries class.

Declaration

public FunnelSeries()

Methods

deepClone() Method

Creates a copy of the funnel series.

Declaration

public FunnelSeries deepClone()

Returns

Type Description
FunnelSeries

A copy of the funnel series.

getChartType() Method

Returns the chart type of the series.

Declaration

public ChartExType getChartType()

Returns

Type Description
ChartExType

ChartExType.FUNNEL.

getDataLabels() Method

Returns data label settings for the series.

Declaration

public IFunnelDataLabels getDataLabels()

Returns

Type Description
IFunnelDataLabels

Data label settings.

Remarks

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