ChartCellValue Class
A cell in chart data.
Declaration
public class ChartCellValue extends OfficeObject
Remarks
Call the ChartData.get(cellReference) method or another ChartData.get method overload to access chart data cells.
A cell contains a text, numeric, Boolean, or date value. The method that specifies the value also specifies the value type. For example, the setNumericValue(double value) method specifies a numeric value. Call getIsText(), getIsNumeric(), getIsBoolean(), and getIsDateTime() methods to check the value type. A new cell contains no value, and these methods return false.
Refer to the following help topic for additional information: Load Data into Charts — Presentation API for Java.
Example
Create a Bar Chart with a Title
The following code snippet adds a bar chart to a slide, binds the series to chart data, and adds a chart title:
import java.io.*;
import java.nio.file.*;
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);
// Populate chart data.
ChartData data = chart.getData();
data.get(0, "A1").setNumericValue(120);
data.get(0, "A2").setNumericValue(95);
data.get(0, "A3").setNumericValue(140);
data.get(0, "B1").setTextValue("Q1");
data.get(0, "B2").setTextValue("Q2");
data.get(0, "B3").setTextValue("Q3");
// Bind series values and arguments to chart data ranges.
BarSeries series = new BarSeries();
series.setValues(new ChartDataReference(0, "A1", "A3"));
series.setArguments(new ChartDataReference(0, "B1", "B3"));
chart.getSeries().add(series);
// Add a chart title.
TextProperties titleTextProperties = new TextProperties();
titleTextProperties.setFontSize(30f);
titleTextProperties.setFill(new SolidFill(Color.getDarkBlue()));
chart.setTitle(new ChartTitle(
new TextArea("Quarterly Sales", new TextParagraphProperties(titleTextProperties))));
// 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:

Inherited Members
Inheritance
Methods
deepClone() Method
Creates a copy of the cell.
Declaration
public ChartCellValue deepClone()
Returns
| Type | Description |
|---|---|
ChartCellValue |
A copy of the cell. |
getBooleanValue() Method
Returns the Boolean value of the cell.
Declaration
public boolean getBooleanValue()
Returns
| Type | Description |
|---|---|
| boolean | The Boolean value. |
getDateTimeValue() Method
Returns the date value of the cell.
Declaration
public Instant getDateTimeValue()
Returns
| Type | Description |
|---|---|
| Instant | The date value. |
getIsBoolean() Method
Returns whether the cell contains a Boolean value.
Declaration
public boolean getIsBoolean()
Returns
| Type | Description |
|---|---|
| boolean |
|
getIsDateTime() Method
Returns whether the cell contains a date value.
Declaration
public boolean getIsDateTime()
Returns
| Type | Description |
|---|---|
| boolean |
|
getIsNumeric() Method
Returns whether the cell contains a numeric value.
Declaration
public boolean getIsNumeric()
Returns
| Type | Description |
|---|---|
| boolean |
|
getIsText() Method
Returns whether the cell contains a text value.
Declaration
public boolean getIsText()
Returns
| Type | Description |
|---|---|
| boolean |
|
getNumberFormat() Method
Returns the number format of the cell.
Declaration
public String getNumberFormat()
Returns
| Type | Description |
|---|---|
| String | The number format code, or |
getNumericValue() Method
Returns the numeric value of the cell.
Declaration
public double getNumericValue()
Returns
| Type | Description |
|---|---|
| double | The numeric value. |
getTextValue() Method
Returns the text value of the cell.
Declaration
public String getTextValue()
Returns
| Type | Description |
|---|---|
| String | The text value. |
setBooleanValue(boolean value) Method
Sets the Boolean value of the cell.
Declaration
public void setBooleanValue(boolean value)
Parameters
| Name | Type | Description |
|---|---|---|
| value | boolean | The Boolean value. |
Remarks
The setBooleanValue(value) method changes the cell value type to Boolean. The getIsBoolean() method returns true.
The cell stores a Boolean value as a number: 1 for true and 0 for false. The getBooleanValue() method returns true if the numeric value is not 0.
setDateTimeValue(Instant value) Method
Sets the date value of the cell.
Declaration
public void setDateTimeValue(Instant value)
Parameters
| Name | Type | Description |
|---|---|---|
| value | Instant | The date value. |
Remarks
The setDateTimeValue(value) method changes the cell value type to date. The getIsDateTime() method returns true.
If the cell has no number format, the setDateTimeValue(value) method applies the MM/dd/yyyy format.
setNumberFormat(String value) Method
Sets the number format of the cell.
Declaration
public void setNumberFormat(String value)
Parameters
| Name | Type | Description |
|---|---|---|
| value | String | The number format code (for example, 0.00 or MM/dd/yyyy). |
setNumericValue(double value) Method
Sets the numeric value of the cell.
Declaration
public void setNumericValue(double value)
Parameters
| Name | Type | Description |
|---|---|---|
| value | double | The numeric value. |
Remarks
The setNumericValue(value) method changes the cell value type to numeric. The getIsNumeric() method returns true.
setTextValue(String value) Method
Sets the text value of the cell.
Declaration
public void setTextValue(String value)
Parameters
| Name | Type | Description |
|---|---|---|
| value | String | The text value. |
Remarks
The setTextValue(value) method changes the cell value type to text. The getIsText() method returns true.