Skip to main content

ErrorValueType Enum

Lists calculation modes for error bars.

Declaration

public enum ErrorValueType extends Enum<ErrorValueType> implements IIntEnum

Members

Name Description
CUSTOM

Uses custom error amounts specified by the ErrorBar.setPlus(value) and ErrorBar.setMinus(value) methods.

FIXED_VALUE

Uses a fixed error amount for all data points.

PERCENTAGE

Uses a percentage of each data point value.

STANDARD_DEVIATION

Uses a multiple of the standard deviation.

STANDARD_ERROR

Uses the standard error.

fromValue(int value)

Returns the ErrorValueType enumeration constant with the specified integer value.

getName()

Returns the name of the ErrorValueType enumeration constant.

getValue()

Returns the integer value of the ErrorValueType enumeration constant.

toString()

Returns the string representation of the ErrorValueType enumeration constant.

valueOf(String name)

Returns the ErrorValueType enumeration constant with the specified name.

values()

Returns an array of all ErrorValueType enumeration constants.

Remarks

Call the ErrorBar.getType() method to get the calculation mode for error amounts. Call the ErrorBar.setType(value) method to specify the calculation mode.

Refer to the following help topic for additional information: Add Error Bars and Trend Lines to Charts — Presentation API for Java.

Example

Add Percentage and Custom Error Bars to a Column Chart

The following code snippet creates a column chart with two series, adds percentage error bars with end caps to the first series, and adds custom positive error bars to the second series:

import java.io.*;
import java.nio.file.*;
import java.util.List;
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 {
        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 column series.
            String[] names = { "2024", "2025" };
            double[][] values = { { 42, 55, 48, 61 }, { 47, 52, 58, 66 } };
            for (int i = 0; i < names.length; i++) {
                BarSeries series = new BarSeries();
                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);
            }

            // Display 10% error bars with end caps for the first series.
            ErrorBar percentageErrorBar = new ErrorBar();
            percentageErrorBar.setType(ErrorValueType.PERCENTAGE);
            percentageErrorBar.setValue(10);
            percentageErrorBar.setShowCap(true);
            OutlineStyle errorBarLine = new OutlineStyle();
            errorBarLine.setFill(new SolidFill(Color.getDarkRed()));
            percentageErrorBar.setOutlineStyle(errorBarLine);
            ((BarSeries) chart.getSeries().get(0)).getErrorBars().add(percentageErrorBar);

            // Display custom positive error values for the second series.
            ErrorBar customErrorBar = new ErrorBar();
            customErrorBar.setType(ErrorValueType.CUSTOM);
            customErrorBar.setDirection(ErrorBarDirection.PLUS);
            customErrorBar.setPlus(new ChartNumericData(List.of(3.0, 5.0, 4.0, 6.0)));
            customErrorBar.setShowCap(true);
            ((BarSeries) chart.getSeries().get(1)).getErrorBars().add(customErrorBar);

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

 Column chart with percentage and custom error bars 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
ErrorValueType