mirror of https://github.com/apache/poi.git
remove code smells
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1860311 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
0ccbf4671d
commit
dcb6d534fd
|
@ -183,9 +183,16 @@ class ExcelChartWithTargetLine {
|
|||
barCategories.getOrAddShapeProperties().setLineProperties(categoriesProps);
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
private static XSSFClientAnchor createAnchor(XSSFDrawing drawing, int[] chartedCols) {
|
||||
if (chartedCols.length > 1) {
|
||||
return drawing.createAnchor(0, 0, 0, 0, 0, 8, 10, 23);
|
||||
} else {
|
||||
return drawing.createAnchor(0, 0, 0, 0, 0, 8, 5, 23);
|
||||
}
|
||||
}
|
||||
|
||||
XSSFWorkbook workbook = new XSSFWorkbook();
|
||||
public static void main(String[] args) throws Exception {
|
||||
try (XSSFWorkbook workbook = new XSSFWorkbook()) {
|
||||
XSSFSheet sheet = workbook.createSheet("targetline");
|
||||
final int NUM_OF_COLUMNS = 4;
|
||||
|
||||
|
@ -214,17 +221,13 @@ class ExcelChartWithTargetLine {
|
|||
int[] chartedCols = new int[] { 1, 2 , 3 };
|
||||
|
||||
XSSFDrawing drawing = sheet.createDrawingPatriarch();
|
||||
XSSFClientAnchor anchor = null;
|
||||
if (chartedCols.length > 1) {
|
||||
anchor = drawing.createAnchor(0, 0, 0, 0, 0, 8, 10, 23);
|
||||
} else {
|
||||
anchor = drawing.createAnchor(0, 0, 0, 0, 0, 8, 5, 23);
|
||||
}
|
||||
XSSFClientAnchor anchor = createAnchor(drawing, chartedCols);
|
||||
XSSFChart chart = drawing.createChart(anchor);
|
||||
createChart(chart, sheet, chartedCols, 42.0);
|
||||
|
||||
workbook.write(new FileOutputStream("ExcelChartWithTargetLine.xlsx"));
|
||||
workbook.close();
|
||||
|
||||
try (FileOutputStream fos = new FileOutputStream("ExcelChartWithTargetLine.xlsx")) {
|
||||
workbook.write(fos);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -588,6 +588,7 @@ public abstract class XDDFChart extends POIXMLDocumentPart implements TextContai
|
|||
return new XDDFSurfaceChartData(this, plotArea.addNewSurfaceChart(), categories, mapValues);
|
||||
case SURFACE3D:
|
||||
return new XDDFSurface3DChartData(this, plotArea.addNewSurface3DChart(), categories, mapValues);
|
||||
// TODO repeat above code for missing charts: Bubble, Doughnut, OfPie and Stock
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue