Skip to main content

HistogramBinType Enum

Lists bin types of histogram charts.

Declaration

public enum HistogramBinType extends Enum<HistogramBinType> implements IIntEnum

Members

Name Description
AUTOMATIC

Indicates that the chart calculates the bin width from series data.

BIN_COUNT

Indicates a specified number of bins.

BIN_SIZE

Indicates bins of a specified width.

BY_CATEGORY

Indicates a bin for each category. The bin value is the sum of values in the category.

fromValue(int value)

Returns the HistogramBinType enumeration constant with the specified integer value.

getName()

Returns the name of the HistogramBinType enumeration constant.

getValue()

Returns the integer value of the HistogramBinType enumeration constant.

toString()

Returns the string representation of the HistogramBinType enumeration constant.

valueOf(String name)

Returns the HistogramBinType enumeration constant with the specified name.

values()

Returns an array of all HistogramBinType enumeration constants.

Remarks

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 Histogram Chart with an Overflow Bin

The following code snippet creates a histogram chart that groups values into bins of a specified width, combines values above a boundary into an overflow bin, and displays data labels:

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 histogram series and specify data.
            HistogramSeries series = new HistogramSeries();
            series.setText("Delivery Time");
            series.setValues(new ChartNumericData(List.of(
                    2.0, 3.0, 4.0, 4.0, 5.0, 6.0, 6.0, 7.0, 8.0, 9.0,
                    11.0, 12.0, 14.0, 15.0, 18.0, 22.0, 27.0, 35.0)));

            // Group values into bins of 5 days and combine values above 20 days.
            series.setBinType(HistogramBinType.BIN_SIZE);
            series.setBinSize(5);
            series.setOverflowType(HistogramOverflowType.FIXED);
            series.setOverflow(20);

            // Display the number of values in each bin.
            series.getDataLabels().setShowValue(true);
            series.getDataLabels().setLabelPosition(HistogramDataLabelPosition.OUTSIDE_END);
            chart.getSeries().add(series);

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

 Histogram chart with fixed-width bins, an overflow bin, and data labels created with the DevExpress Presentation API for Java

Implements

com.devexpress.java.enums.IIntEnum

Inherited Members

java.lang.Enum.<T>valueOf(java.lang.Class<T>,java.lang.String)
java.lang.Enum.clone()
java.lang.Enum.compareTo(E)
java.lang.Enum.describeConstable()
java.lang.Enum.equals(java.lang.Object)
java.lang.Enum.finalize()
java.lang.Enum.getDeclaringClass()
java.lang.Enum.hashCode()
java.lang.Enum.name()
java.lang.Enum.ordinal()
java.lang.Enum.toString()
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
java.lang.Enum
HistogramBinType