Skip to main content

BubbleChartView Class

Contains settings that apply to bubble series in a chart view.

Declaration

public class BubbleChartView extends ColorfulChartView

Remarks

When you add a BubbleSeries object to a chart, the chart creates a BubbleChartView object for the series. Call the Chart.getViews() method to access chart views.

Refer to the following help topic for additional information: Create Standard Charts — Presentation API for Java.

Example

Create a Bubble Chart

The following code snippet creates a bubble chart, reduces the bubble size, and displays bubble sizes in 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.
            Chart chart = new Chart();
            chart.setWidth(presentation.getSlideSize().getWidth());
            chart.setHeight(presentation.getSlideSize().getHeight());
            slide.getShapes().add(chart);

            // Create a bubble series: X values, Y values, and bubble sizes.
            BubbleSeries series = new BubbleSeries();
            series.setText("Products");
            series.setArguments(new ChartNumericData(List.of(10.0, 25.0, 40.0, 55.0)));
            series.setValues(new ChartNumericData(List.of(30.0, 55.0, 20.0, 70.0)));
            series.setBubbleSize(new ChartNumericData(List.of(120.0, 60.0, 200.0, 90.0)));
            chart.getSeries().add(series);

            // Reduce bubble size and display bubble sizes in data labels.
            BubbleChartView view = (BubbleChartView) chart.getViews().get(0);
            view.setBubbleScale(60);
            view.getDataLabels().setShowBubbleSize(true);
            view.getDataLabels().setLabelPosition(BubbleDataLabelPosition.CENTER);

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

 Bubble chart with bubble sizes in data labels 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

See Also

BubbleChartView()

Initializes a new instance of the BubbleChartView class.

Declaration

public BubbleChartView()

Methods

getBubbleScale() Method

Returns the bubble scale as a percentage of the default bubble size.

Declaration

public int getBubbleScale()

Returns

Type Description
int

The bubble scale as a percentage (from 0 to 300).

getChartType() Method

Returns the chart type of the view.

Declaration

public ChartType getChartType()

Returns

Type Description
ChartType

ChartType.BUBBLE.

getDataLabels() Method

Returns data label settings for all series in the view.

Declaration

public IBubbleDataLabels getDataLabels()

Returns

Type Description
IBubbleDataLabels

Data label settings.

Remarks

Call the BubbleSeries.getDataLabels() method to access data label settings for an individual series.

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

getDisplayBubblesAs3D() Method

Returns whether the view displays bubbles with a 3D effect.

Declaration

public boolean getDisplayBubblesAs3D()

Returns

Type Description
boolean

true if the view displays bubbles with a 3D effect; otherwise, false.

getShowNegativeBubbles() Method

Returns whether the view displays bubbles with negative size values.

Declaration

public boolean getShowNegativeBubbles()

Returns

Type Description
boolean

true if the view displays bubbles with negative size values; otherwise, false.

getSizeRepresentation() Method

Returns the bubble dimension that bubble size values determine.

Declaration

public BubbleSizeRepresentation getSizeRepresentation()

Returns

Type Description
BubbleSizeRepresentation

The bubble dimension that bubble size values determine.

setBubbleScale(int value) Method

Sets the bubble scale as a percentage of the default bubble size.

Declaration

public void setBubbleScale(int value)

Parameters

Name Type Description
value int

The bubble scale as a percentage (from 0 to 300).

Exceptions

Type Description
ArgumentOutOfRangeException

Thrown if the value parameter is less than 0 or greater than 300.

Remarks

The value range is from 0 to 300. If you do not call the setBubbleScale(value) method, the API uses 100.

setDisplayBubblesAs3D(boolean value) Method

Sets whether to display bubbles in the view with a 3D effect.

Declaration

public void setDisplayBubblesAs3D(boolean value)

Parameters

Name Type Description
value boolean

true to display bubbles with a 3D effect; otherwise, false.

Remarks

If you do not call the setDisplayBubblesAs3D(value) method, the API uses false.

setShowNegativeBubbles(boolean value) Method

Sets whether to display bubbles with negative size values.

Declaration

public void setShowNegativeBubbles(boolean value)

Parameters

Name Type Description
value boolean

true to display bubbles with negative size values; otherwise, false.

Remarks

If you do not call the setShowNegativeBubbles(value) method, the API uses false.

setSizeRepresentation(BubbleSizeRepresentation value) Method

Sets the bubble dimension that bubble size values determine.

Declaration

public void setSizeRepresentation(BubbleSizeRepresentation value)

Parameters

Name Type Description
value BubbleSizeRepresentation

The bubble dimension that bubble size values determine.

Remarks

The setSizeRepresentation(value) method accepts the following values:

Value Description
AREA Indicates that bubble size values determine bubble area.
WIDTH Indicates that bubble size values determine bubble width.

If you do not call the setSizeRepresentation(value) method, the API uses BubbleSizeRepresentation.AREA.