Skip to main content

RadarDataLabel Class

Contains settings for a data label in a radar chart.

Declaration

public class RadarDataLabel extends DataLabel

Remarks

The RadarDataLabel class inherits label content and formatting settings from DataLabel and DataLabelBase classes (for example, RadarDataLabel.setShowValue(value) and RadarDataLabel.setCustomText(value) methods).

To format the data label of an individual data point, pass a RadarDataLabel object to the IRadarDataLabels.setLabel(key, value) method.

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

Example

Create a Filled Radar Chart

The following code snippet creates a filled radar chart that compares two products and displays a data label for one data point:

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);

            // Add a radar series for each product.
            String[] names = { "Product A", "Product B" };
            double[][] scores = { { 8, 6, 9, 5, 7 }, { 6, 9, 5, 8, 6 } };
            for (int i = 0; i < names.length; i++) {
                RadarSeries series = new RadarSeries();
                series.setText(names[i]);
                series.setArguments(new ChartStringData(List.of("Price", "Quality", "Design", "Support", "Delivery")));
                series.setValues(new ChartNumericData(List.of(scores[i][0], scores[i][1], scores[i][2], scores[i][3], scores[i][4])));
                chart.getSeries().add(series);
            }

            // Display series as filled areas.
            RadarChartView view = (RadarChartView) chart.getViews().get(0);
            view.setStyle(RadarChartStyle.FILLED);

            // Display the Design score of the first product.
            RadarDataLabel label = new RadarDataLabel();
            label.setShowValue(true);
            RadarSeries firstSeries = (RadarSeries) chart.getSeries().get(0);
            firstSeries.getDataLabels().setLabel(2, label);

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

 Filled radar chart that compares two products 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
JavaObject
See Also

RadarDataLabel()

Initializes a new instance of the RadarDataLabel class.

Declaration

public RadarDataLabel()

Methods

deepClone() Method

Returns a deep copy of this RadarDataLabel instance.

Declaration

public RadarDataLabel deepClone()

Returns

Type Description
RadarDataLabel

A deep copy of this RadarDataLabel.