DataTableOptions Class
Contains settings for a chart data table.
Declaration
public class DataTableOptions extends ChartElement
Remarks
A data table displays chart data in a grid below the plot area. To display a data table, pass a DataTableOptions object to the Chart.setDataTable(value) method.
The DataTableOptions class inherits fill and outline settings from the ChartElement class.
Refer to the following help topic for additional information: Create Standard Charts — Presentation API for Java.
Example: Display a Data Table Below a Chart
The following code snippet creates a line chart with three series and displays a data table with borders, an outline, and legend keys:
import java.io.*;
import java.nio.file.*;
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);
// Populate chart data: quarters in column A and values in columns B to D.
ChartData data = chart.getData();
String[] quarters = { "Q1", "Q2", "Q3" };
double[][] values = { { 120, 95, 140 }, { 90, 110, 125 }, { 20, 60, 50 } };
for (int row = 0; row < quarters.length; row++) {
data.get("A" + (row + 1)).setTextValue(quarters[row]);
for (int column = 0; column < values.length; column++)
data.get((char) ('B' + column) + String.valueOf(row + 1)).setNumericValue(values[column][row]);
}
// Add a line series for each value column.
for (String column : new String[] { "B", "C", "D" }) {
LineSeries series = new LineSeries();
series.setArguments(new ChartDataReference("A1", "A3"));
series.setValues(new ChartDataReference(column + "1", column + "3"));
chart.getSeries().add(series);
}
// Display a data table with borders, an outline, and legend keys.
DataTableOptions dataTable = new DataTableOptions();
dataTable.setShowHorizontalBorder(true);
dataTable.setShowVerticalBorder(true);
dataTable.setShowOutline(true);
dataTable.setShowLegendKeys(true);
chart.setDataTable(dataTable);
// Save the presentation.
Files.createDirectories(Path.of("output"));
try (OutputStream output = Files.newOutputStream(Path.of("output", "Chart.pptx"))) {
presentation.save(output);
}
}
}
}
Inherited Members
Inheritance
DataTableOptions()
Initializes a new instance of the DataTableOptions class.
Declaration
public DataTableOptions()
Methods
deepClone() Method
Creates a copy of the data table settings.
Declaration
public DataTableOptions deepClone()
Returns
| Type | Description |
|---|---|
DataTableOptions |
A copy of the data table settings. |
getShowHorizontalBorder() Method
Returns whether the data table displays horizontal borders.
Declaration
public boolean getShowHorizontalBorder()
Returns
| Type | Description |
|---|---|
| boolean |
|
getShowLegendKeys() Method
Returns whether the data table displays legend keys next to series names.
Declaration
public boolean getShowLegendKeys()
Returns
| Type | Description |
|---|---|
| boolean |
|
getShowOutline() Method
Returns whether the data table displays an outline.
Declaration
public boolean getShowOutline()
Returns
| Type | Description |
|---|---|
| boolean |
|
getShowVerticalBorder() Method
Returns whether the data table displays vertical borders.
Declaration
public boolean getShowVerticalBorder()
Returns
| Type | Description |
|---|---|
| boolean |
|
getTextProperties() Method
Returns text formatting settings for the data table.
Declaration
public TextProperties getTextProperties()
Returns
| Type | Description |
|---|---|
| TextProperties | Text formatting settings, or |
setShowHorizontalBorder(boolean value) Method
Sets whether the data table displays horizontal borders.
Declaration
public void setShowHorizontalBorder(boolean value)
Parameters
| Name | Type | Description |
|---|---|---|
| value | boolean |
|
Remarks
A new DataTableOptions object does not display horizontal borders.
setShowLegendKeys(boolean value) Method
Sets whether the data table displays legend keys next to series names.
Declaration
public void setShowLegendKeys(boolean value)
Parameters
| Name | Type | Description |
|---|---|---|
| value | boolean |
|
Remarks
A new DataTableOptions object does not display legend keys next to series names.
setShowOutline(boolean value) Method
Sets whether the data table displays an outline.
Declaration
public void setShowOutline(boolean value)
Parameters
| Name | Type | Description |
|---|---|---|
| value | boolean |
|
Remarks
A new DataTableOptions object does not display an outline.
setShowVerticalBorder(boolean value) Method
Sets whether the data table displays vertical borders.
Declaration
public void setShowVerticalBorder(boolean value)
Parameters
| Name | Type | Description |
|---|---|---|
| value | boolean |
|
Remarks
A new DataTableOptions object does not display vertical borders.
setTextProperties(TextProperties value) Method
Sets text formatting settings for the data table.
Declaration
public void setTextProperties(TextProperties value)
Parameters
| Name | Type | Description |
|---|---|---|
| value | TextProperties | Text formatting settings. |