ChartDataTable
Inheritance: java.lang.Object
All Implemented Interfaces: java.lang.Cloneable
public class ChartDataTable implements Cloneable
Allows to specify properties of a chart data table.
Examples:
Shows how to show data table with chart series data.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
Shape shape = builder.insertChart(ChartType.COLUMN, 432.0, 252.0);
Chart chart = shape.getChart();
ChartSeriesCollection series = chart.getSeries();
series.clear();
double[] xValues = new double[] { 2020.0, 2021.0, 2022.0, 2023.0 };
series.add("Series1", xValues, new double[] { 5.0, 11.0, 2.0, 7.0 });
series.add("Series2", xValues, new double[] { 6.0, 5.5, 7.0, 7.8 });
series.add("Series3", xValues, new double[] { 10.0, 8.0, 7.0, 9.0 });
ChartDataTable dataTable = chart.getDataTable();
dataTable.setShow(true);
dataTable.hasLegendKeys(false);
dataTable.hasHorizontalBorder(false);
dataTable.hasVerticalBorder(false);
dataTable.getFont().setItalic(true);
dataTable.getFormat().getStroke().setWeight(1.0);
dataTable.getFormat().getStroke().setDashStyle(DashStyle.SHORT_DOT);
dataTable.getFormat().getStroke().setColor(Color.BLUE);
doc.save(getArtifactsDir() + "Charts.DataTable.docx");
Methods
Method | Description |
---|---|
fetchSpecialDefaultRunPropertyValue(int key) | |
generateItemText() | |
getFont() | Provides access to font formatting of the data table. |
getFormat() | Provides access to fill of text background and border formatting of the data table. |
getRelativePropertyValue(int key, Object value) | |
getShapeType() | |
getShow() | Gets a flag indicating whether the data table will be shown for the chart. |
hasHorizontalBorder() | Gets a flag indicating whether a horizontal border of the data table is displayed. |
hasHorizontalBorder(boolean value) | Sets a flag indicating whether a horizontal border of the data table is displayed. |
hasLegendKeys() | Gets a flag indicating whether legend keys are displayed in the data table. |
hasLegendKeys(boolean value) | Sets a flag indicating whether legend keys are displayed in the data table. |
hasOutlineBorder() | Gets a flag indicating whether an outline border, that is, a border around series and category names, is displayed. |
hasOutlineBorder(boolean value) | Sets a flag indicating whether an outline border, that is, a border around series and category names, is displayed. |
hasVerticalBorder() | Gets a flag indicating whether a vertical border of the data table is displayed. |
hasVerticalBorder(boolean value) | Sets a flag indicating whether a vertical border of the data table is displayed. |
isFillSupported() | |
isFormatDefined() | |
materializeSpPr() | |
setShapeType(int value) | |
setShow(boolean value) | Sets a flag indicating whether the data table will be shown for the chart. |
fetchSpecialDefaultRunPropertyValue(int key)
public Object fetchSpecialDefaultRunPropertyValue(int key)
Parameters:
Parameter | Type | Description |
---|---|---|
key | int |
Returns: java.lang.Object
generateItemText()
public String generateItemText()
Returns: java.lang.String
getFont()
public Font getFont()
Provides access to font formatting of the data table.
Returns: Font - The corresponding Font value.
getFormat()
public ChartFormat getFormat()
Provides access to fill of text background and border formatting of the data table.
Returns: ChartFormat - The corresponding ChartFormat value.
getRelativePropertyValue(int key, Object value)
public Object getRelativePropertyValue(int key, Object value)
Parameters:
Parameter | Type | Description |
---|---|---|
key | int | |
value | java.lang.Object |
Returns: java.lang.Object
getShapeType()
public int getShapeType()
Returns: int
getShow()
public boolean getShow()
Gets a flag indicating whether the data table will be shown for the chart. Default value is false .
Remarks:
The following chart types do not support data tables: Scatter, Pie, Doughnut, Surface, Radar, Treemap, Sunburst, Histogram, Pareto, Box and Whisker, Waterfall, Funnel, Combo charts that include series of these types. Showing a data table for the chart types throws a java.lang.IllegalStateException exception.
Examples:
Shows how to show data table with chart series data.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
Shape shape = builder.insertChart(ChartType.COLUMN, 432.0, 252.0);
Chart chart = shape.getChart();
ChartSeriesCollection series = chart.getSeries();
series.clear();
double[] xValues = new double[] { 2020.0, 2021.0, 2022.0, 2023.0 };
series.add("Series1", xValues, new double[] { 5.0, 11.0, 2.0, 7.0 });
series.add("Series2", xValues, new double[] { 6.0, 5.5, 7.0, 7.8 });
series.add("Series3", xValues, new double[] { 10.0, 8.0, 7.0, 9.0 });
ChartDataTable dataTable = chart.getDataTable();
dataTable.setShow(true);
dataTable.hasLegendKeys(false);
dataTable.hasHorizontalBorder(false);
dataTable.hasVerticalBorder(false);
dataTable.getFont().setItalic(true);
dataTable.getFormat().getStroke().setWeight(1.0);
dataTable.getFormat().getStroke().setDashStyle(DashStyle.SHORT_DOT);
dataTable.getFormat().getStroke().setColor(Color.BLUE);
doc.save(getArtifactsDir() + "Charts.DataTable.docx");
Returns: boolean - A flag indicating whether the data table will be shown for the chart.
hasHorizontalBorder()
public boolean hasHorizontalBorder()
Gets a flag indicating whether a horizontal border of the data table is displayed. The default value is true .
Returns: boolean - A flag indicating whether a horizontal border of the data table is displayed.
hasHorizontalBorder(boolean value)
public void hasHorizontalBorder(boolean value)
Sets a flag indicating whether a horizontal border of the data table is displayed. The default value is true .
Parameters:
Parameter | Type | Description |
---|---|---|
value | boolean | A flag indicating whether a horizontal border of the data table is displayed. |
hasLegendKeys()
public boolean hasLegendKeys()
Gets a flag indicating whether legend keys are displayed in the data table. The default value is true .
Returns: boolean - A flag indicating whether legend keys are displayed in the data table.
hasLegendKeys(boolean value)
public void hasLegendKeys(boolean value)
Sets a flag indicating whether legend keys are displayed in the data table. The default value is true .
Parameters:
Parameter | Type | Description |
---|---|---|
value | boolean | A flag indicating whether legend keys are displayed in the data table. |
hasOutlineBorder()
public boolean hasOutlineBorder()
Gets a flag indicating whether an outline border, that is, a border around series and category names, is displayed. The default value is true .
Returns: boolean - A flag indicating whether an outline border, that is, a border around series and category names, is displayed.
hasOutlineBorder(boolean value)
public void hasOutlineBorder(boolean value)
Sets a flag indicating whether an outline border, that is, a border around series and category names, is displayed. The default value is true .
Parameters:
Parameter | Type | Description |
---|---|---|
value | boolean | A flag indicating whether an outline border, that is, a border around series and category names, is displayed. |
hasVerticalBorder()
public boolean hasVerticalBorder()
Gets a flag indicating whether a vertical border of the data table is displayed. The default value is true .
Returns: boolean - A flag indicating whether a vertical border of the data table is displayed.
hasVerticalBorder(boolean value)
public void hasVerticalBorder(boolean value)
Sets a flag indicating whether a vertical border of the data table is displayed. The default value is true .
Parameters:
Parameter | Type | Description |
---|---|---|
value | boolean | A flag indicating whether a vertical border of the data table is displayed. |
isFillSupported()
public boolean isFillSupported()
Returns: boolean
isFormatDefined()
public boolean isFormatDefined()
Returns: boolean
materializeSpPr()
public void materializeSpPr()
setShapeType(int value)
public void setShapeType(int value)
Parameters:
Parameter | Type | Description |
---|---|---|
value | int |
setShow(boolean value)
public void setShow(boolean value)
Sets a flag indicating whether the data table will be shown for the chart. Default value is false .
Remarks:
The following chart types do not support data tables: Scatter, Pie, Doughnut, Surface, Radar, Treemap, Sunburst, Histogram, Pareto, Box and Whisker, Waterfall, Funnel, Combo charts that include series of these types. Showing a data table for the chart types throws a java.lang.IllegalStateException exception.
Examples:
Shows how to show data table with chart series data.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
Shape shape = builder.insertChart(ChartType.COLUMN, 432.0, 252.0);
Chart chart = shape.getChart();
ChartSeriesCollection series = chart.getSeries();
series.clear();
double[] xValues = new double[] { 2020.0, 2021.0, 2022.0, 2023.0 };
series.add("Series1", xValues, new double[] { 5.0, 11.0, 2.0, 7.0 });
series.add("Series2", xValues, new double[] { 6.0, 5.5, 7.0, 7.8 });
series.add("Series3", xValues, new double[] { 10.0, 8.0, 7.0, 9.0 });
ChartDataTable dataTable = chart.getDataTable();
dataTable.setShow(true);
dataTable.hasLegendKeys(false);
dataTable.hasHorizontalBorder(false);
dataTable.hasVerticalBorder(false);
dataTable.getFont().setItalic(true);
dataTable.getFormat().getStroke().setWeight(1.0);
dataTable.getFormat().getStroke().setDashStyle(DashStyle.SHORT_DOT);
dataTable.getFormat().getStroke().setColor(Color.BLUE);
doc.save(getArtifactsDir() + "Charts.DataTable.docx");
Parameters:
Parameter | Type | Description |
---|---|---|
value | boolean | A flag indicating whether the data table will be shown for the chart. |