[]
Use this interface to access or format the data table displayed beneath a chart, including its font, border options, and legend key display.
worksheet.getRange("A1:C3").setValue(new Object[][] {
{"Item", "Estimated", "Actual"},
{"Income", 63300, 57450},
{"Expenses", 54500, 49630}
});
IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered, 20, 20, 300, 200).getChart();
chart.getSeriesCollection().add(worksheet.getRange("A1:C3"));
chart.setHasDataTable(true);
IDataTable dataTable = chart.getDataTable();
voiddelete()getFont()IFontFormat object for the chart data table.booleanbooleanbooleanIChart of the data table.booleanvoidsetHasBorderHorizontal(boolean value) voidsetHasBorderOutline(boolean value) voidsetHasBorderVertical(boolean value) voidsetShowLegendKey(boolean value) IFontFormat object for the chart data table.Use the returned font format to read or modify font settings for the text displayed in the data table.
worksheet.getRange("A1:B3").setValue(new Object[][] {
{"Month", "Sales"},
{"Jan", 100},
{"Feb", 120}
});
IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered, 20, 20, 300, 200).getChart();
chart.getSeriesCollection().add(worksheet.getRange("B1:B3"), RowCol.Columns, true, true);
chart.setHasDataTable(true);
IFontFormat font = chart.getDataTable().getFont();
font.getColor().setRGB(Color.GetRed());
IFontFormat object for the chart data table.Use the returned IChartFormat object to access the fill and line formatting settings of the chart data table.
worksheet.getRange("A1:C3").setValue(new Object[][] {
{"Month", "Sales", "Profit"},
{"Jan", 100, 20},
{"Feb", 120, 25}
});
worksheet.getShapes().addChart(ChartType.ColumnClustered, 20, 20, 300, 200)
.getChart().getSeriesCollection().add(worksheet.getRange("A1:C3"));
worksheet.getShapes().get(0).getChart().setHasDataTable(true);
worksheet.getShapes().get(0).getChart().getDataTable().getFormat().getLine().setWeight(1.5);
IChartFormat.IChart of the data table.Use this method to access the chart that owns the current data table.
worksheet.getRange("A1:B3").setValue(new Object[][] {
{"Month", "Sales"},
{"Jan", 100},
{"Feb", 120}
});
IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered, 20, 20, 300, 200).getChart();
chart.getSeriesCollection().add(worksheet.getRange("A1:B3"), RowCol.Columns, true, true);
chart.setHasDataTable(true);
IChart parentChart = chart.getDataTable().getParent();
This property indicates whether the chart data table displays a legend key for each series. The default value is true.
worksheet.getRange("A1:C3").setValue(new Object[][] {
{"Month", "Sales", "Target"},
{"Jan", 100, 90},
{"Feb", 120, 110}
});
IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered, 20, 20, 300, 200).getChart();
chart.getSeriesCollection().add(worksheet.getRange("A1:C3"), RowCol.Columns, true, true);
chart.setHasDataTable(true);
boolean showLegendKey = chart.getDataTable().getShowLegendKey();
Use this method to show or hide the legend key for each series in the chart data table. The default setting is true.
worksheet.getRange("A1:C3").setValue(new Object[][] {
{"Item", "Planned", "Actual"},
{"Sales", 120, 135},
{"Cost", 80, 75}
});
com.grapecity.documents.excel.drawing.IChart chart = worksheet.getShapes()
.addChart(com.grapecity.documents.excel.drawing.ChartType.ColumnClustered, 20, 20, 300, 200)
.getChart();
chart.getSeriesCollection().add(worksheet.getRange("A1:C3"));
chart.setHasDataTable(true);
chart.getDataTable().setShowLegendKey(false);
value - true to display legend keys in the chart data table; otherwise, false.This property indicates whether horizontal border lines are shown between rows in the chart data table. The default value is true.
worksheet.getRange("A1:C3").setValue(new Object[][] {
{"Item", "Planned", "Actual"},
{"Sales", 120, 135},
{"Cost", 80, 75}
});
com.grapecity.documents.excel.drawing.IChart chart = worksheet.getShapes()
.addChart(com.grapecity.documents.excel.drawing.ChartType.ColumnClustered, 20, 20, 300, 200)
.getChart();
chart.getSeriesCollection().add(worksheet.getRange("A1:C3"));
chart.setHasDataTable(true);
boolean hasHorizontalBorder = chart.getDataTable().getHasBorderHorizontal();
Use this method to show or hide horizontal border lines between rows in the chart data table.
worksheet.getRange("A1:C3").setValue(new Object[][] {
{"Item", "Planned", "Actual"},
{"Sales", 120, 135},
{"Cost", 80, 75}
});
IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered, 20, 20, 300, 200).getChart();
chart.getSeriesCollection().add(worksheet.getRange("A1:C3"));
chart.setHasDataTable(true);
chart.getDataTable().setHasBorderHorizontal(false);
value - true to display horizontal cell borders in the chart data table; otherwise, false.The default value is true. This property indicates whether vertical border lines are displayed between cells in the chart data table.
worksheet.getRange("A1:B3").setValue(new Object[][] {
{"Month", "Sales"},
{"Jan", 100},
{"Feb", 120}
});
IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered, 20, 20, 300, 200).getChart();
chart.getSeriesCollection().add(worksheet.getRange("B1:B3"), RowCol.Columns, true, true);
chart.setHasDataTable(true);
chart.getDataTable().setHasBorderVertical(false);
boolean hasBorderVertical = chart.getDataTable().getHasBorderVertical();
Set this property to true to display vertical border lines between cells in the chart data table, or false to hide them.
worksheet.getRange("A1:B3").setValue(new Object[][] {
{"Month", "Sales"},
{"Jan", 100},
{"Feb", 120}
});
IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered, 20, 20, 300, 200).getChart();
chart.getSeriesCollection().add(worksheet.getRange("B1:B3"), RowCol.Columns, true, true);
chart.setHasDataTable(true);
chart.getDataTable().setHasBorderVertical(false);
value - true to display vertical cell borders in the chart data table; otherwise, false.The default value is true. This property indicates whether an outer border is displayed around the chart data table.
worksheet.getRange("A1:C3").setValue(new Object[][] {
{"Month", "Sales", "Profit"},
{"Jan", 100, 20},
{"Feb", 120, 25}
});
IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered, 20, 20, 300, 200).getChart();
chart.getSeriesCollection().add(worksheet.getRange("A1:C3"));
chart.setHasDataTable(true);
boolean hasBorderOutline = chart.getDataTable().getHasBorderOutline();
Use this property to show or hide the outer border around the chart data table.
worksheet.getRange("A1:C3").setValue(new Object[][] {
{"Month", "Sales", "Profit"},
{"Jan", 100, 20},
{"Feb", 120, 25}
});
IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered, 20, 20, 300, 200).getChart();
chart.getSeriesCollection().add(worksheet.getRange("A1:C3"));
chart.setHasDataTable(true);
chart.getDataTable().setHasBorderOutline(false);
value - true to display outline borders for the chart data table; otherwise, false.After this method is called, the data table is removed from its parent IChart.
worksheet.getRange("A1:C3").setValue(new Object[][] {
{"Month", "Sales", "Profit"},
{"Jan", 100, 20},
{"Feb", 120, 25}
});
IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered, 20, 20, 300, 200).getChart();
chart.getSeriesCollection().add(worksheet.getRange("A1:C3"));
chart.setHasDataTable(true);
chart.getDataTable().delete();