values1[6] = 16.0; // if you ever want to change the underlying data
final XDDFNumericalDataSource<? extends Number> valuesData2 = XDDFDataSourcesFactory.fromArray(values2, valuesDataRange2, 2);
- XDDFChartData.Series series1 = bar.getSeries().get(0);
+ XDDFChartData.Series series1 = bar.getSeries(0);
series1.replaceData(categoriesData, valuesData);
series1.setTitle(series[0], chart.setSheetTitle(series[0], 0));
XDDFChartData.Series series2 = bar.addSeries(categoriesData, valuesData2);
final XDDFDataSource<?> categoriesData = XDDFDataSourcesFactory.fromArray(categories, categoryDataRange);
final XDDFNumericalDataSource<? extends Number> valuesData = XDDFDataSourcesFactory.fromArray(values, valuesDataRange);
- XDDFPieChartData.Series firstSeries = (XDDFPieChartData.Series) pie.getSeries().get(0);
+ XDDFPieChartData.Series firstSeries = (XDDFPieChartData.Series) pie.getSeries(0);
firstSeries.replaceData(categoriesData, valuesData);
firstSeries.setTitle(chartTitle, chart.setSheetTitle(chartTitle, 0));
- firstSeries.setExplosion(25);
+ firstSeries.setExplosion(25L);
chart.plot(pie);
// save the result
// the line chart on secondary axis
XDDFLineChartData lines = (XDDFLineChartData) chart.createData(ChartTypes.LINE, lineCategories,
rightValues);
-
- //uncomment below line if only primary axis required and comment above line
+
+ //uncomment below line if only primary axis required and comment above line
// the line chart on primary axis
/*XDDFLineChartData lines = (XDDFLineChartData) chart.createData(ChartTypes.LINE, lineCategories,
leftValues);*/
-
-
+
+
XDDFLineChartData.Series series2 = (XDDFLineChartData.Series) lines.addSeries(xs, ys2);
- series2.updateIdXVal(1);
- series2.updateOrderVal(1);
+ series2.setIndex(1);
+ series2.setOrder(1);
series2.setTitle("Lines", new CellReference("Sheet1!$C$1"));
lines.setVaryColors(true);
chart.plot(lines);
values1[6] = 16.0; // if you ever want to change the underlying data
final XDDFNumericalDataSource<? extends Number> valuesData2 = XDDFDataSourcesFactory.fromArray(values2, valuesDataRange2, 2);
- XDDFChartData.Series series1 = bar.getSeries().get(0);
+ XDDFChartData.Series series1 = bar.getSeries(0);
series1.replaceData(categoriesData, valuesData);
series1.setTitle(series[0], chart.setSheetTitle(series[0], 0));
XDDFChartData.Series series2 = bar.addSeries(categoriesData, valuesData2);
}
}
- public Boolean getScaled() {
+ public Boolean isScaled() {
if (props.isSetScaled()) {
return props.getScaled();
} else {
--- /dev/null
+/* ====================================================================
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+==================================================================== */
+
+package org.apache.poi.xddf.usermodel.chart;
+
+import java.util.HashMap;
+
+import org.openxmlformats.schemas.drawingml.x2006.chart.STShape;
+
+public enum Shape {
+ BOX(STShape.BOX),
+ CONE(STShape.CONE),
+ CONE_TO_MAX(STShape.CONE_TO_MAX),
+ CYLINDER(STShape.CYLINDER),
+ PYRAMID(STShape.PYRAMID),
+ PYRAMID_TO_MAX(STShape.PYRAMID_TO_MAX);
+
+ final STShape.Enum underlying;
+
+ Shape(STShape.Enum grouping) {
+ this.underlying = grouping;
+ }
+
+ private final static HashMap<STShape.Enum, Shape> reverse = new HashMap<>();
+ static {
+ for (Shape value : values()) {
+ reverse.put(value.underlying, value);
+ }
+ }
+
+ static Shape valueOf(STShape.Enum grouping) {
+ return reverse.get(grouping);
+ }
+}
import java.util.Map;
import org.apache.poi.util.Beta;
+import org.apache.poi.util.Internal;
import org.apache.poi.xddf.usermodel.XDDFShapeProperties;
import org.openxmlformats.schemas.drawingml.x2006.chart.CTArea3DChart;
import org.openxmlformats.schemas.drawingml.x2006.chart.CTAreaSer;
defineAxes(chart.getAxIdArray(), categories, values);
}
+ @Internal
@Override
- public void setVaryColors(boolean varyColors) {
- if (chart.isSetVaryColors()) {
- chart.getVaryColors().setVal(varyColors);
+ protected void removeCTSeries(int n) {
+ chart.removeSer(n);
+ }
+
+ @Override
+ public void setVaryColors(Boolean varyColors) {
+ if (varyColors == null) {
+ if (chart.isSetVaryColors()) {
+ chart.unsetVaryColors();
+ }
} else {
- chart.addNewVaryColors().setVal(varyColors);
+ if (chart.isSetVaryColors()) {
+ chart.getVaryColors().setVal(varyColors);
+ } else {
+ chart.addNewVaryColors().setVal(varyColors);
+ }
}
}
public Grouping getGrouping() {
- return Grouping.valueOf(chart.getGrouping().getVal());
+ if (chart.isSetGrouping()) {
+ return Grouping.valueOf(chart.getGrouping().getVal());
+ } else {
+ return null;
+ }
}
- public void setGrouping(Grouping grouping) {
- if (chart.getGrouping() != null) {
- chart.getGrouping().setVal(grouping.underlying);
- } else {
- chart.addNewGrouping().setVal(grouping.underlying);
- }
- }
+ public void setGrouping(Grouping grouping) {
+ if (grouping == null) {
+ if (chart.isSetGrouping()) {
+ chart.unsetGrouping();
+ }
+ } else {
+ if (chart.isSetGrouping()) {
+ chart.getGrouping().setVal(grouping.underlying);
+ } else {
+ chart.addNewGrouping().setVal(grouping.underlying);
+ }
+ }
+ }
+
+ public Integer getGapDepth() {
+ if (chart.isSetGapDepth()) {
+ return chart.getGapDepth().getVal();
+ } else {
+ return null;
+ }
+ }
+
+ public void setGapDepth(Integer depth) {
+ if (depth == null) {
+ if (chart.isSetGapDepth()) {
+ chart.unsetGapDepth();
+ }
+ } else {
+ if (chart.isSetGapDepth()) {
+ chart.getGapDepth().setVal(depth);
+ } else {
+ chart.addNewGapDepth().setVal(depth);
+ }
+ }
+ }
@Override
public XDDFChartData.Series addSeries(XDDFDataSource<?> category,
protected CTNumDataSource getNumDS() {
return series.getVal();
}
-
+
@Override
- public void updateIdXVal(long val) {
+ public void setIndex(long val) {
series.getIdx().setVal(val);
}
-
+
@Override
- public void updateOrderVal(long val) {
+ public void setOrder(long val) {
series.getOrder().setVal(val);
}
}
import java.util.Map;
import org.apache.poi.util.Beta;
+import org.apache.poi.util.Internal;
import org.apache.poi.xddf.usermodel.XDDFShapeProperties;
import org.openxmlformats.schemas.drawingml.x2006.chart.CTAreaChart;
import org.openxmlformats.schemas.drawingml.x2006.chart.CTAreaSer;
import org.openxmlformats.schemas.drawingml.x2006.chart.CTAxDataSource;
-import org.openxmlformats.schemas.drawingml.x2006.chart.CTLineChart;
-import org.openxmlformats.schemas.drawingml.x2006.chart.CTLineSer;
-import org.openxmlformats.schemas.drawingml.x2006.chart.CTMarker;
import org.openxmlformats.schemas.drawingml.x2006.chart.CTNumDataSource;
import org.openxmlformats.schemas.drawingml.x2006.chart.CTSerTx;
defineAxes(chart.getAxIdArray(), categories, values);
}
+ @Internal
@Override
- public void setVaryColors(boolean varyColors) {
- if (chart.isSetVaryColors()) {
- chart.getVaryColors().setVal(varyColors);
+ protected void removeCTSeries(int n) {
+ chart.removeSer(n);
+ }
+
+ @Override
+ public void setVaryColors(Boolean varyColors) {
+ if (varyColors == null) {
+ if (chart.isSetVaryColors()) {
+ chart.unsetVaryColors();
+ }
} else {
- chart.addNewVaryColors().setVal(varyColors);
+ if (chart.isSetVaryColors()) {
+ chart.getVaryColors().setVal(varyColors);
+ } else {
+ chart.addNewVaryColors().setVal(varyColors);
+ }
}
}
public Grouping getGrouping() {
- return Grouping.valueOf(chart.getGrouping().getVal());
+ if (chart.isSetGrouping()) {
+ return Grouping.valueOf(chart.getGrouping().getVal());
+ } else {
+ return null;
+ }
}
- public void setGrouping(Grouping grouping) {
- if (chart.getGrouping() != null) {
- chart.getGrouping().setVal(grouping.underlying);
- } else {
- chart.addNewGrouping().setVal(grouping.underlying);
- }
- }
+ public void setGrouping(Grouping grouping) {
+ if (grouping == null) {
+ if (chart.isSetGrouping()) {
+ chart.unsetGrouping();
+ }
+ } else {
+ if (chart.isSetGrouping()) {
+ chart.getGrouping().setVal(grouping.underlying);
+ } else {
+ chart.addNewGrouping().setVal(grouping.underlying);
+ }
+ }
+ }
@Override
public XDDFChartData.Series addSeries(XDDFDataSource<?> category,
protected CTNumDataSource getNumDS() {
return series.getVal();
}
-
+
@Override
- public void updateIdXVal(long val) {
+ public void setIndex(long val) {
series.getIdx().setVal(val);
}
-
+
@Override
- public void updateOrderVal(long val) {
+ public void setOrder(long val) {
series.getOrder().setVal(val);
}
}
import java.util.Map;
import org.apache.poi.util.Beta;
+import org.apache.poi.util.Internal;
import org.apache.poi.xddf.usermodel.XDDFShapeProperties;
import org.openxmlformats.schemas.drawingml.x2006.chart.CTAxDataSource;
import org.openxmlformats.schemas.drawingml.x2006.chart.CTBar3DChart;
defineAxes(chart.getAxIdArray(), categories, values);
}
+ @Internal
@Override
- public void setVaryColors(boolean varyColors) {
- if (chart.isSetVaryColors()) {
- chart.getVaryColors().setVal(varyColors);
+ protected void removeCTSeries(int n) {
+ chart.removeSer(n);
+ }
+
+ @Override
+ public void setVaryColors(Boolean varyColors) {
+ if (varyColors == null) {
+ if (chart.isSetVaryColors()) {
+ chart.unsetVaryColors();
+ }
} else {
- chart.addNewVaryColors().setVal(varyColors);
+ if (chart.isSetVaryColors()) {
+ chart.getVaryColors().setVal(varyColors);
+ } else {
+ chart.addNewVaryColors().setVal(varyColors);
+ }
}
}
if (chart.isSetGrouping()) {
return BarGrouping.valueOf(chart.getGrouping().getVal());
} else {
- return BarGrouping.STANDARD;
+ return null;
}
}
public void setBarGrouping(BarGrouping grouping) {
- if (chart.isSetGrouping()) {
- chart.getGrouping().setVal(grouping.underlying);
+ if (grouping == null) {
+ if (chart.isSetGrouping()) {
+ chart.unsetGrouping();
+ }
+ } else {
+ if (chart.isSetGrouping()) {
+ chart.getGrouping().setVal(grouping.underlying);
+ } else {
+ chart.addNewGrouping().setVal(grouping.underlying);
+ }
+ }
+ }
+
+ public Integer getGapDepth() {
+ if (chart.isSetGapDepth()) {
+ return chart.getGapDepth().getVal();
+ } else {
+ return null;
+ }
+ }
+
+ public void setGapDepth(Integer depth) {
+ if (depth == null) {
+ if (chart.isSetGapDepth()) {
+ chart.unsetGapDepth();
+ }
} else {
- chart.addNewGrouping().setVal(grouping.underlying);
+ if (chart.isSetGapDepth()) {
+ chart.getGapDepth().setVal(depth);
+ } else {
+ chart.addNewGapDepth().setVal(depth);
+ }
}
}
- public int getGapWidth() {
+ public Integer getGapWidth() {
if (chart.isSetGapWidth()) {
return chart.getGapWidth().getVal();
} else {
- return 0;
+ return null;
}
}
- public void setGapWidth(int width) {
- if (chart.isSetGapWidth()) {
- chart.getGapWidth().setVal(width);
+ public void setGapWidth(Integer width) {
+ if (width == null) {
+ if (chart.isSetGapWidth()) {
+ chart.unsetGapWidth();
+ }
+ } else {
+ if (chart.isSetGapWidth()) {
+ chart.getGapWidth().setVal(width);
+ } else {
+ chart.addNewGapWidth().setVal(width);
+ }
+ }
+ }
+
+ public Shape getShape() {
+ if (chart.isSetShape()) {
+ return Shape.valueOf(chart.getShape().getVal());
} else {
- chart.addNewGapWidth().setVal(width);
+ return null;
+ }
+ }
+
+ public void setShape(Shape shape) {
+ if (shape == null) {
+ if (chart.isSetShape()) {
+ chart.unsetShape();
+ }
+ } else {
+ if (chart.isSetShape()) {
+ chart.getShape().setVal(shape.underlying);
+ } else {
+ chart.addNewShape().setVal(shape.underlying);
+ }
}
}
protected CTNumDataSource getNumDS() {
return series.getVal();
}
-
+
@Override
- public void updateIdXVal(long val) {
+ public void setIndex(long val) {
series.getIdx().setVal(val);
}
-
+
@Override
- public void updateOrderVal(long val) {
+ public void setOrder(long val) {
series.getOrder().setVal(val);
}
}
import java.util.Map;
import org.apache.poi.util.Beta;
+import org.apache.poi.util.Internal;
import org.apache.poi.xddf.usermodel.XDDFShapeProperties;
import org.openxmlformats.schemas.drawingml.x2006.chart.CTAxDataSource;
import org.openxmlformats.schemas.drawingml.x2006.chart.CTBarChart;
defineAxes(chart.getAxIdArray(), categories, values);
}
+ @Internal
@Override
- public void setVaryColors(boolean varyColors) {
- if (chart.isSetVaryColors()) {
- chart.getVaryColors().setVal(varyColors);
+ protected void removeCTSeries(int n) {
+ chart.removeSer(n);
+ }
+
+ @Override
+ public void setVaryColors(Boolean varyColors) {
+ if (varyColors == null) {
+ if (chart.isSetVaryColors()) {
+ chart.unsetVaryColors();
+ }
} else {
- chart.addNewVaryColors().setVal(varyColors);
+ if (chart.isSetVaryColors()) {
+ chart.getVaryColors().setVal(varyColors);
+ } else {
+ chart.addNewVaryColors().setVal(varyColors);
+ }
}
}
if (chart.isSetGrouping()) {
return BarGrouping.valueOf(chart.getGrouping().getVal());
} else {
- return BarGrouping.STANDARD;
+ return null;
}
}
public void setBarGrouping(BarGrouping grouping) {
- if (chart.isSetGrouping()) {
- chart.getGrouping().setVal(grouping.underlying);
+ if (grouping == null) {
+ if (chart.isSetGrouping()) {
+ chart.unsetGrouping();
+ }
} else {
- chart.addNewGrouping().setVal(grouping.underlying);
+ if (chart.isSetGrouping()) {
+ chart.getGrouping().setVal(grouping.underlying);
+ } else {
+ chart.addNewGrouping().setVal(grouping.underlying);
+ }
}
}
- public int getGapWidth() {
+ public Integer getGapWidth() {
if (chart.isSetGapWidth()) {
return chart.getGapWidth().getVal();
} else {
- return 0;
+ return null;
}
}
- public void setGapWidth(int width) {
- if (chart.isSetGapWidth()) {
- chart.getGapWidth().setVal(width);
+ public void setGapWidth(Integer width) {
+ if (width == null) {
+ if (chart.isSetGapWidth()) {
+ chart.unsetGapWidth();
+ }
} else {
- chart.addNewGapWidth().setVal(width);
+ if (chart.isSetGapWidth()) {
+ chart.getGapWidth().setVal(width);
+ } else {
+ chart.addNewGapWidth().setVal(width);
+ }
+ }
+ }
+
+ public Byte getOverlap() {
+ if (chart.isSetOverlap()) {
+ return chart.getOverlap().getVal();
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * Minimum inclusive: -100
+ * <br/>
+ * Maximum inclusive: 100
+ * @param overlap
+ */
+ public void setOverlap(Byte overlap) {
+ if (overlap == null) {
+ if (chart.isSetOverlap()) {
+ chart.unsetOverlap();
+ }
+ } else {
+ if (overlap < -100 || 100 < overlap) {
+ return;
+ }
+ if (chart.isSetOverlap()) {
+ chart.getOverlap().setVal(overlap);
+ } else {
+ chart.addNewOverlap().setVal(overlap);
+ }
}
}
protected CTNumDataSource getNumDS() {
return series.getVal();
}
-
+
@Override
- public void updateIdXVal(long val) {
- series.getIdx().setVal(val);
- }
-
- @Override
- public void updateOrderVal(long val) {
- series.getOrder().setVal(val);
- }
+ protected void setIndex(long index) {
+ series.getIdx().setVal(index);
+ }
+
+ @Override
+ protected void setOrder(long order) {
+ series.getOrder().setVal(order);
+ }
}
}
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.apache.xmlbeans.XmlException;
import org.apache.xmlbeans.XmlOptions;
+import org.openxmlformats.schemas.drawingml.x2006.chart.CTArea3DChart;
+import org.openxmlformats.schemas.drawingml.x2006.chart.CTAreaChart;
+import org.openxmlformats.schemas.drawingml.x2006.chart.CTBar3DChart;
import org.openxmlformats.schemas.drawingml.x2006.chart.CTBarChart;
import org.openxmlformats.schemas.drawingml.x2006.chart.CTBoolean;
import org.openxmlformats.schemas.drawingml.x2006.chart.CTCatAx;
import org.openxmlformats.schemas.drawingml.x2006.chart.CTChart;
import org.openxmlformats.schemas.drawingml.x2006.chart.CTChartSpace;
import org.openxmlformats.schemas.drawingml.x2006.chart.CTDateAx;
+import org.openxmlformats.schemas.drawingml.x2006.chart.CTLine3DChart;
import org.openxmlformats.schemas.drawingml.x2006.chart.CTLineChart;
+import org.openxmlformats.schemas.drawingml.x2006.chart.CTPie3DChart;
import org.openxmlformats.schemas.drawingml.x2006.chart.CTPieChart;
import org.openxmlformats.schemas.drawingml.x2006.chart.CTPlotArea;
import org.openxmlformats.schemas.drawingml.x2006.chart.CTRadarChart;
import org.openxmlformats.schemas.drawingml.x2006.chart.CTScatterChart;
import org.openxmlformats.schemas.drawingml.x2006.chart.CTSerAx;
import org.openxmlformats.schemas.drawingml.x2006.chart.CTSurface;
+import org.openxmlformats.schemas.drawingml.x2006.chart.CTSurface3DChart;
+import org.openxmlformats.schemas.drawingml.x2006.chart.CTSurfaceChart;
import org.openxmlformats.schemas.drawingml.x2006.chart.CTTitle;
import org.openxmlformats.schemas.drawingml.x2006.chart.CTValAx;
import org.openxmlformats.schemas.drawingml.x2006.chart.CTView3D;
@Beta
public abstract class XDDFChart extends POIXMLDocumentPart implements TextContainer {
-
+
/**
* default width of chart in emu
*/
* default height of chart in emu
*/
public static final int DEFAULT_HEIGHT = 500000;
-
+
/**
* default x-coordinate of chart in emu
*/
* default y-coordinate value of chart in emu
*/
public static final int DEFAULT_Y = 10;
-
+
/**
* Underlying workbook
*/
Map<Long, XDDFChartAxis> categories = getCategoryAxes();
Map<Long, XDDFValueAxis> values = getValueAxes();
+ for (int i = 0; i < plotArea.sizeOfAreaChartArray(); i++) {
+ CTAreaChart areaChart = plotArea.getAreaChartArray(i);
+ series.add(new XDDFAreaChartData(areaChart, categories, values));
+ }
+
+ for (int i = 0; i < plotArea.sizeOfArea3DChartArray(); i++) {
+ CTArea3DChart areaChart = plotArea.getArea3DChartArray(i);
+ series.add(new XDDFArea3DChartData(areaChart, categories, values));
+ }
+
for (int i = 0; i < plotArea.sizeOfBarChartArray(); i++) {
CTBarChart barChart = plotArea.getBarChartArray(i);
series.add(new XDDFBarChartData(barChart, categories, values));
}
+ for (int i = 0; i < plotArea.sizeOfBar3DChartArray(); i++) {
+ CTBar3DChart barChart = plotArea.getBar3DChartArray(i);
+ series.add(new XDDFBar3DChartData(barChart, categories, values));
+ }
+
for (int i = 0; i < plotArea.sizeOfLineChartArray(); i++) {
CTLineChart lineChart = plotArea.getLineChartArray(i);
series.add(new XDDFLineChartData(lineChart, categories, values));
}
+ for (int i = 0; i < plotArea.sizeOfLine3DChartArray(); i++) {
+ CTLine3DChart lineChart = plotArea.getLine3DChartArray(i);
+ series.add(new XDDFLine3DChartData(lineChart, categories, values));
+ }
+
for (int i = 0; i < plotArea.sizeOfPieChartArray(); i++) {
CTPieChart pieChart = plotArea.getPieChartArray(i);
series.add(new XDDFPieChartData(pieChart));
}
+ for (int i = 0; i < plotArea.sizeOfPie3DChartArray(); i++) {
+ CTPie3DChart pieChart = plotArea.getPie3DChartArray(i);
+ series.add(new XDDFPie3DChartData(pieChart));
+ }
+
for (int i = 0; i < plotArea.sizeOfRadarChartArray(); i++) {
CTRadarChart radarChart = plotArea.getRadarChartArray(i);
series.add(new XDDFRadarChartData(radarChart, categories, values));
series.add(new XDDFScatterChartData(scatterChart, categories, values));
}
- // TODO repeat above code for all kind of charts
+ for (int i = 0; i < plotArea.sizeOfSurfaceChartArray(); i++) {
+ CTSurfaceChart surfaceChart = plotArea.getSurfaceChartArray(i);
+ series.add(new XDDFSurfaceChartData(surfaceChart, categories, values));
+ }
+
+ for (int i = 0; i < plotArea.sizeOfSurface3DChartArray(); i++) {
+ CTSurface3DChart surfaceChart = plotArea.getSurface3DChartArray(i);
+ series.add(new XDDFSurface3DChartData(surfaceChart, categories, values));
+ }
+
+ // TODO repeat above code for missing charts: Bubble, Doughnut, OfPie and Stock
return series;
}
}
/**
- * this method will return series axis with specified position
+ * this method will return series axis with specified position
*
* @param pos axis position Left, Right, Top, Bottom
* @return series axis with specified position
public XDDFChartData createData(ChartTypes type, XDDFChartAxis category, XDDFValueAxis values) {
Map<Long, XDDFChartAxis> categories = null;
Map<Long, XDDFValueAxis> mapValues = null;
-
- if(ChartTypes.PIE != type && ChartTypes.PIE3D != type)
- {
+
+ if (ChartTypes.PIE != type && ChartTypes.PIE3D != type) {
categories = Collections.singletonMap(category.getId(), category);
mapValues = Collections.singletonMap(values.getId(), values);
}
-
+
final CTPlotArea plotArea = getCTPlotArea();
switch (type) {
case AREA:
XSSFRow row = this.getRow(sheet, 0);
XSSFCell cell = this.getCell(row, column);
cell.setCellValue(title);
-
+
CTTable ctTable = this.getSheetTable(sheet);
-
+
this.updateSheetTable(ctTable, title, column);
return new CellReference(sheet.getSheetName(), 0, column, true, true);
}
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
+import java.util.Locale;
import java.util.Map;
import org.apache.poi.ss.util.CellReference;
import org.apache.poi.util.Beta;
+import org.apache.poi.util.Internal;
import org.apache.poi.xddf.usermodel.XDDFShapeProperties;
import org.openxmlformats.schemas.drawingml.x2006.chart.CTAxDataSource;
import org.openxmlformats.schemas.drawingml.x2006.chart.CTNumData;
return valueAxes;
}
+ /**
+ * Calls to <code>getSeries().add(series)</code> or to <code>getSeries().remove(series)</code>
+ * may corrupt the workbook.
+ *
+ * <p>
+ * Instead, use the following methods:
+ * <ul>
+ * <li>{@link #getSeriesCount()}</li>
+ * <li>{@link #getSeries(int)}</li>
+ * <li>{@link #addSeries(XDDFDataSource,XDDFNumericalDataSource)}</li>
+ * <li>{@link #removeSeries(int)}</li>
+ * </ul>
+ *
+ * @deprecated since POI 4.1.1
+ * @return
+ */
+ @Deprecated
public List<Series> getSeries() {
return series;
}
- public abstract void setVaryColors(boolean varyColors);
+ public final int getSeriesCount() {
+ return series.size();
+ }
+
+ public final Series getSeries(int n) {
+ return series.get(n);
+ }
+
+ public final void removeSeries(int n) {
+ final String procName = "removeSeries";
+ if (n < 0 || series.size() <= n) {
+ throw new IllegalArgumentException(String.format(Locale.ROOT, "%s(%d): illegal index", procName, n));
+ }
+ series.remove(n);
+ removeCTSeries(n);
+ }
+
+ /**
+ * This method should be implemented in every class that extends <code>XDDFChartData</code>.
+ * <p>
+ * A typical implementation would be
+ *
+ * <pre><code>
+ protected void removeCTSeries(int n) {
+ chart.removeSer(n);
+ }
+
+ * </code></pre>
+ *
+ * @param n
+ */
+ @Internal
+ protected abstract void removeCTSeries(int n);
+
+ public abstract void setVaryColors(Boolean varyColors);
public abstract XDDFChartData.Series addSeries(XDDFDataSource<?> category,
XDDFNumericalDataSource<? extends Number> values);
protected abstract CTNumDataSource getNumDS();
- /**
- * This method will update series id value
- *
- * @param val
- */
- public abstract void updateIdXVal(long val);
-
- /**
- * this method will update series order value
- *
- * @param val
- */
- public abstract void updateOrderVal(long val);
+ protected abstract void setIndex(long index);
+
+ protected abstract void setOrder(long order);
protected Series(XDDFDataSource<?> category, XDDFNumericalDataSource<? extends Number> values) {
replaceData(category, values);
import java.util.Map;
import org.apache.poi.util.Beta;
+import org.apache.poi.util.Internal;
import org.apache.poi.xddf.usermodel.XDDFShapeProperties;
import org.openxmlformats.schemas.drawingml.x2006.chart.CTAxDataSource;
import org.openxmlformats.schemas.drawingml.x2006.chart.CTLine3DChart;
defineAxes(chart.getAxIdArray(), categories, values);
}
+ @Internal
@Override
- public void setVaryColors(boolean varyColors) {
- if (chart.isSetVaryColors()) {
- chart.getVaryColors().setVal(varyColors);
+ protected void removeCTSeries(int n) {
+ chart.removeSer(n);
+ }
+
+ @Override
+ public void setVaryColors(Boolean varyColors) {
+ if (varyColors == null) {
+ if (chart.isSetVaryColors()) {
+ chart.unsetVaryColors();
+ }
} else {
- chart.addNewVaryColors().setVal(varyColors);
+ if (chart.isSetVaryColors()) {
+ chart.getVaryColors().setVal(varyColors);
+ } else {
+ chart.addNewVaryColors().setVal(varyColors);
+ }
}
}
}
}
+ public Integer getGapDepth() {
+ if (chart.isSetGapDepth()) {
+ return chart.getGapDepth().getVal();
+ } else {
+ return null;
+ }
+ }
+
+ public void setGapDepth(Integer depth) {
+ if (depth == null) {
+ if (chart.isSetGapDepth()) {
+ chart.unsetGapDepth();
+ }
+ } else {
+ if (chart.isSetGapDepth()) {
+ chart.getGapDepth().setVal(depth);
+ } else {
+ chart.addNewGapDepth().setVal(depth);
+ }
+ }
+ }
+
@Override
public XDDFChartData.Series addSeries(XDDFDataSource<?> category,
XDDFNumericalDataSource<? extends Number> values) {
}
- public Boolean getSmooth() {
+ public Boolean isSmooth() {
if (series.isSetSmooth()) {
return series.getSmooth().getVal();
} else {
protected CTNumDataSource getNumDS() {
return series.getVal();
}
-
+
@Override
- public void updateIdXVal(long val) {
+ public void setIndex(long val) {
series.getIdx().setVal(val);
}
-
+
@Override
- public void updateOrderVal(long val) {
+ public void setOrder(long val) {
series.getOrder().setVal(val);
}
}
import java.util.Map;
import org.apache.poi.util.Beta;
+import org.apache.poi.util.Internal;
import org.apache.poi.xddf.usermodel.XDDFShapeProperties;
import org.openxmlformats.schemas.drawingml.x2006.chart.CTAxDataSource;
import org.openxmlformats.schemas.drawingml.x2006.chart.CTLineChart;
defineAxes(chart.getAxIdArray(), categories, values);
}
+ @Internal
@Override
- public void setVaryColors(boolean varyColors) {
- if (chart.isSetVaryColors()) {
- chart.getVaryColors().setVal(varyColors);
+ protected void removeCTSeries(int n) {
+ chart.removeSer(n);
+ }
+
+ @Override
+ public void setVaryColors(Boolean varyColors) {
+ if (varyColors == null) {
+ if (chart.isSetVaryColors()) {
+ chart.unsetVaryColors();
+ }
} else {
- chart.addNewVaryColors().setVal(varyColors);
+ if (chart.isSetVaryColors()) {
+ chart.getVaryColors().setVal(varyColors);
+ } else {
+ chart.addNewVaryColors().setVal(varyColors);
+ }
}
}
/**
* @since 4.0.1
*/
- public Boolean getSmooth() {
+ public Boolean isSmooth() {
if (series.isSetSmooth()) {
return series.getSmooth().getVal();
} else {
protected CTNumDataSource getNumDS() {
return series.getVal();
}
-
+
@Override
- public void updateIdXVal(long val) {
+ public void setIndex(long val) {
series.getIdx().setVal(val);
}
-
+
@Override
- public void updateOrderVal(long val) {
+ public void setOrder(long val) {
series.getOrder().setVal(val);
}
}
package org.apache.poi.xddf.usermodel.chart;
import org.apache.poi.util.Beta;
+import org.apache.poi.util.Internal;
import org.apache.poi.xddf.usermodel.XDDFShapeProperties;
import org.openxmlformats.schemas.drawingml.x2006.chart.CTAxDataSource;
import org.openxmlformats.schemas.drawingml.x2006.chart.CTNumDataSource;
}
}
+ @Internal
@Override
- public void setVaryColors(boolean varyColors) {
- if (chart.isSetVaryColors()) {
- chart.getVaryColors().setVal(varyColors);
+ protected void removeCTSeries(int n) {
+ chart.removeSer(n);
+ }
+
+ @Override
+ public void setVaryColors(Boolean varyColors) {
+ if (varyColors == null) {
+ if (chart.isSetVaryColors()) {
+ chart.unsetVaryColors();
+ }
} else {
- chart.addNewVaryColors().setVal(varyColors);
+ if (chart.isSetVaryColors()) {
+ chart.getVaryColors().setVal(varyColors);
+ } else {
+ chart.addNewVaryColors().setVal(varyColors);
+ }
}
}
}
}
- public long getExplosion() {
+ public Long getExplosion() {
if (series.isSetExplosion()) {
return series.getExplosion().getVal();
} else {
- return 0;
+ return null;
}
}
- public void setExplosion(long explosion) {
- if (series.isSetExplosion()) {
- series.getExplosion().setVal(explosion);
+ public void setExplosion(Long explosion) {
+ if (explosion == null) {
+ if (series.isSetExplosion()) {
+ series.unsetExplosion();
+ }
} else {
- series.addNewExplosion().setVal(explosion);
+ if (series.isSetExplosion()) {
+ series.getExplosion().setVal(explosion);
+ } else {
+ series.addNewExplosion().setVal(explosion);
+ }
}
}
protected CTNumDataSource getNumDS() {
return series.getVal();
}
-
+
@Override
- public void updateIdXVal(long val) {
+ public void setIndex(long val) {
series.getIdx().setVal(val);
}
-
+
@Override
- public void updateOrderVal(long val) {
+ public void setOrder(long val) {
series.getOrder().setVal(val);
}
}
package org.apache.poi.xddf.usermodel.chart;
import org.apache.poi.util.Beta;
+import org.apache.poi.util.Internal;
import org.apache.poi.xddf.usermodel.XDDFShapeProperties;
import org.openxmlformats.schemas.drawingml.x2006.chart.CTAxDataSource;
import org.openxmlformats.schemas.drawingml.x2006.chart.CTNumDataSource;
}
}
+ @Internal
@Override
- public void setVaryColors(boolean varyColors) {
- if (chart.isSetVaryColors()) {
- chart.getVaryColors().setVal(varyColors);
+ protected void removeCTSeries(int n) {
+ chart.removeSer(n);
+ }
+
+ @Override
+ public void setVaryColors(Boolean varyColors) {
+ if (varyColors == null) {
+ if (chart.isSetVaryColors()) {
+ chart.unsetVaryColors();
+ }
} else {
- chart.addNewVaryColors().setVal(varyColors);
+ if (chart.isSetVaryColors()) {
+ chart.getVaryColors().setVal(varyColors);
+ } else {
+ chart.addNewVaryColors().setVal(varyColors);
+ }
+ }
+ }
+
+ public Integer getFirstSliceAngle() {
+ if (chart.isSetFirstSliceAng()) {
+ return chart.getFirstSliceAng().getVal();
+ } else {
+ return null;
+ }
+ }
+
+ public void setFirstSliceAngle(Integer angle) {
+ if (angle == null) {
+ if (chart.isSetFirstSliceAng()) {
+ chart.unsetFirstSliceAng();
+ }
+ } else {
+ if (angle < 0 || 360 < angle) {
+ throw new IllegalArgumentException("angle must be between 0 and 360");
+ }
+ if (chart.isSetFirstSliceAng()) {
+ chart.getFirstSliceAng().setVal(angle);
+ } else {
+ chart.addNewFirstSliceAng().setVal(angle);
+ }
}
}
}
}
- public long getExplosion() {
+ public Long getExplosion() {
if (series.isSetExplosion()) {
return series.getExplosion().getVal();
} else {
- return 0;
+ return null;
}
}
- public void setExplosion(long explosion) {
- if (series.isSetExplosion()) {
- series.getExplosion().setVal(explosion);
+ public void setExplosion(Long explosion) {
+ if (explosion == null) {
+ if (series.isSetExplosion()) {
+ series.unsetExplosion();
+ }
} else {
- series.addNewExplosion().setVal(explosion);
+ if (series.isSetExplosion()) {
+ series.getExplosion().setVal(explosion);
+ } else {
+ series.addNewExplosion().setVal(explosion);
+ }
}
}
protected CTNumDataSource getNumDS() {
return series.getVal();
}
-
+
@Override
- public void updateIdXVal(long val) {
+ public void setIndex(long val) {
series.getIdx().setVal(val);
}
-
+
@Override
- public void updateOrderVal(long val) {
+ public void setOrder(long val) {
series.getOrder().setVal(val);
}
}
import java.util.Map;
import org.apache.poi.util.Beta;
+import org.apache.poi.util.Internal;
import org.apache.poi.xddf.usermodel.XDDFShapeProperties;
import org.openxmlformats.schemas.drawingml.x2006.chart.CTAxDataSource;
import org.openxmlformats.schemas.drawingml.x2006.chart.CTNumDataSource;
defineAxes(chart.getAxIdArray(), categories, values);
}
+ @Internal
@Override
- public void setVaryColors(boolean varyColors) {
- if (chart.isSetVaryColors()) {
- chart.getVaryColors().setVal(varyColors);
+ protected void removeCTSeries(int n) {
+ chart.removeSer(n);
+ }
+
+ @Override
+ public void setVaryColors(Boolean varyColors) {
+ if (varyColors == null) {
+ if (chart.isSetVaryColors()) {
+ chart.unsetVaryColors();
+ }
} else {
- chart.addNewVaryColors().setVal(varyColors);
+ if (chart.isSetVaryColors()) {
+ chart.getVaryColors().setVal(varyColors);
+ } else {
+ chart.addNewVaryColors().setVal(varyColors);
+ }
}
}
protected CTNumDataSource getNumDS() {
return series.getVal();
}
-
+
@Override
- public void updateIdXVal(long val) {
+ public void setIndex(long val) {
series.getIdx().setVal(val);
}
-
- @Override
- public void updateOrderVal(long val) {
- series.getOrder().setVal(val);
- }
+
+ @Override
+ public void setOrder(long val) {
+ series.getOrder().setVal(val);
+ }
}
}
import java.util.Map;
import org.apache.poi.util.Beta;
+import org.apache.poi.util.Internal;
import org.apache.poi.xddf.usermodel.XDDFShapeProperties;
import org.openxmlformats.schemas.drawingml.x2006.chart.CTAxDataSource;
import org.openxmlformats.schemas.drawingml.x2006.chart.CTMarker;
defineAxes(chart.getAxIdArray(), categories, values);
}
+ @Internal
@Override
- public void setVaryColors(boolean varyColors) {
- if (chart.isSetVaryColors()) {
- chart.getVaryColors().setVal(varyColors);
+ protected void removeCTSeries(int n) {
+ chart.removeSer(n);
+ }
+
+ @Override
+ public void setVaryColors(Boolean varyColors) {
+ if (varyColors == null) {
+ if (chart.isSetVaryColors()) {
+ chart.unsetVaryColors();
+ }
} else {
- chart.addNewVaryColors().setVal(varyColors);
+ if (chart.isSetVaryColors()) {
+ chart.getVaryColors().setVal(varyColors);
+ } else {
+ chart.addNewVaryColors().setVal(varyColors);
+ }
}
}
/**
* @since 4.0.1
*/
- public Boolean getSmooth() {
+ public Boolean isSmooth() {
if (series.isSetSmooth()) {
return series.getSmooth().getVal();
} else {
protected CTNumDataSource getNumDS() {
return series.getYVal();
}
-
+
@Override
- public void updateIdXVal(long val) {
+ public void setIndex(long val) {
series.getIdx().setVal(val);
}
-
- @Override
- public void updateOrderVal(long val) {
- series.getOrder().setVal(val);
- }
+
+ @Override
+ public void setOrder(long val) {
+ series.getOrder().setVal(val);
+ }
}
}
import java.util.Map;
import org.apache.poi.util.Beta;
+import org.apache.poi.util.Internal;
import org.apache.poi.xddf.usermodel.XDDFShapeProperties;
import org.openxmlformats.schemas.drawingml.x2006.chart.CTAxDataSource;
-import org.openxmlformats.schemas.drawingml.x2006.chart.CTBoolean;
import org.openxmlformats.schemas.drawingml.x2006.chart.CTNumDataSource;
import org.openxmlformats.schemas.drawingml.x2006.chart.CTSerTx;
import org.openxmlformats.schemas.drawingml.x2006.chart.CTSurface3DChart;
}
defineAxes(chart.getAxIdArray(), categories, values);
}
-
- public void setSeriesAxisId(XDDFSeriesAxis seriesAxis) {
- chart.addNewAxId().setVal(seriesAxis.getId());
+
+ @Internal
+ @Override
+ protected void removeCTSeries(int n) {
+ chart.removeSer(n);
+ }
+
+ /**
+ * Surface chart is not supporting vary color property.
+ */
+ @Override
+ public void setVaryColors(Boolean varyColors) {
+ // nothing to do
}
-
- public CTBoolean getWireframe() {
+
+ public void defineSeriesAxis(XDDFSeriesAxis seriesAxis) {
+ chart.addNewAxId().setVal(seriesAxis.getId());
+ }
+
+ public Boolean isWireframe() {
if (chart.isSetWireframe()) {
- return chart.getWireframe();
+ return chart.getWireframe().getVal();
} else {
- return chart.addNewWireframe();
+ return null;
}
}
- public void setWireframe(boolean val) {
- if (chart.isSetWireframe()) {
- chart.getWireframe().setVal(val);
+ public void setWireframe(Boolean show) {
+ if (show == null) {
+ if (chart.isSetWireframe()) {
+ chart.unsetWireframe();
+ }
} else {
- chart.addNewWireframe().setVal(val);
+ if (chart.isSetWireframe()) {
+ chart.getWireframe().setVal(show);
+ } else {
+ chart.addNewWireframe().setVal(show);
+ }
}
}
- /**
- * Surface chart is not supporting vary color property
- */
- @Override
- public void setVaryColors(boolean varyColors) {
-
- }
-
@Override
public XDDFChartData.Series addSeries(XDDFDataSource<?> category,
XDDFNumericalDataSource<? extends Number> values) {
}
/**
- * Surface chart is not supporting vary show leader lines property
+ * Surface chart is not supporting show leader lines property
*/
@Override
public void setShowLeaderLines(boolean showLeaderLines) {
-
+ // nothing to do
}
@Override
protected CTNumDataSource getNumDS() {
return series.getVal();
}
-
+
@Override
- public void updateIdXVal(long val) {
+ public void setIndex(long val) {
series.getIdx().setVal(val);
}
-
+
@Override
- public void updateOrderVal(long val) {
+ public void setOrder(long val) {
series.getOrder().setVal(val);
}
}
import java.util.Map;
import org.apache.poi.util.Beta;
+import org.apache.poi.util.Internal;
import org.apache.poi.xddf.usermodel.XDDFShapeProperties;
import org.openxmlformats.schemas.drawingml.x2006.chart.CTAxDataSource;
-import org.openxmlformats.schemas.drawingml.x2006.chart.CTBoolean;
import org.openxmlformats.schemas.drawingml.x2006.chart.CTNumDataSource;
import org.openxmlformats.schemas.drawingml.x2006.chart.CTSerTx;
import org.openxmlformats.schemas.drawingml.x2006.chart.CTSurfaceChart;
@Beta
public class XDDFSurfaceChartData extends XDDFChartData {
private CTSurfaceChart chart;
-
public XDDFSurfaceChartData(CTSurfaceChart chart, Map<Long, XDDFChartAxis> categories,
Map<Long, XDDFValueAxis> values) {
this.chart = chart;
}
defineAxes(categories, values);
}
+
private void defineAxes(Map<Long, XDDFChartAxis> categories, Map<Long, XDDFValueAxis> values) {
if (chart.sizeOfAxIdArray() == 0) {
for (Long id : categories.keySet()) {
defineAxes(chart.getAxIdArray(), categories, values);
}
- public void setSeriesAxisId(XDDFSeriesAxis seriesAxis) {
- chart.addNewAxId().setVal(seriesAxis.getId());
+ @Internal
+ @Override
+ protected void removeCTSeries(int n) {
+ chart.removeSer(n);
+ }
+
+ /**
+ * Surface chart is not supporting vary color property.
+ */
+ @Override
+ public void setVaryColors(Boolean varyColors) {
+ // nothing to do
+ }
+
+ public void defineSeriesAxis(XDDFSeriesAxis seriesAxis) {
+ chart.addNewAxId().setVal(seriesAxis.getId());
}
-
- public CTBoolean getWireframe() {
+
+ public Boolean isWireframe() {
if (chart.isSetWireframe()) {
- return chart.getWireframe();
+ return chart.getWireframe().getVal();
} else {
- return chart.addNewWireframe();
+ return null;
}
}
- public void setWireframe(boolean val) {
- if (chart.isSetWireframe()) {
- chart.getWireframe().setVal(val);
+ public void setWireframe(Boolean show) {
+ if (show == null) {
+ if (chart.isSetWireframe()) {
+ chart.unsetWireframe();
+ }
} else {
- chart.addNewWireframe().setVal(val);
+ if (chart.isSetWireframe()) {
+ chart.getWireframe().setVal(show);
+ } else {
+ chart.addNewWireframe().setVal(show);
+ }
}
}
- /**
- * Surface chart is not supporting vary color property
- */
- @Override
- public void setVaryColors(boolean varyColors) {
-
- }
-
@Override
public XDDFChartData.Series addSeries(XDDFDataSource<?> category,
XDDFNumericalDataSource<? extends Number> values) {
}
/**
- * Surface chart is not supporting vary show leader lines property
+ * Surface chart is not supporting show leader lines property
*/
@Override
public void setShowLeaderLines(boolean showLeaderLines) {
-
+ // nothing to do
}
@Override
protected CTNumDataSource getNumDS() {
return series.getVal();
}
-
+
@Override
- public void updateIdXVal(long val) {
+ public void setIndex(long val) {
series.getIdx().setVal(val);
}
-
+
@Override
- public void updateOrderVal(long val) {
+ public void setOrder(long val) {
series.getOrder().setVal(val);
}
}
package org.apache.poi.xddf.usermodel.chart;
+import org.apache.poi.util.Internal;
import org.openxmlformats.schemas.drawingml.x2006.chart.CTView3D;
-
public class XDDFView3D {
private final CTView3D view3D;
- public XDDFView3D(CTView3D view3D) {
+ @Internal
+ protected XDDFView3D(CTView3D view3D) {
this.view3D = view3D;
}
-
- public int getXRotationAngle() {
- return view3D.getRotX().getVal();
+
+ public Byte getXRotationAngle() {
+ if (view3D.isSetRotX()) {
+ return view3D.getRotX().getVal();
+ } else {
+ return null;
+ }
+ }
+
+ public void setXRotationAngle(Byte rotation) {
+ if (rotation == null) {
+ if (view3D.isSetRotX()) {
+ view3D.unsetRotX();
+ }
+ } else {
+ if (rotation < -90 || 90 < rotation) {
+ throw new IllegalArgumentException("rotation must be between -90 and 90");
+ }
+ if (view3D.isSetRotX()) {
+ view3D.getRotX().setVal(rotation);
+ } else {
+ view3D.addNewRotX().setVal(rotation);
+ }
+ }
+ }
+
+ public Integer getYRotationAngle() {
+ if (view3D.isSetRotY()) {
+ return view3D.getRotY().getVal();
+ } else {
+ return null;
+ }
+ }
+
+ public void setYRotationAngle(Integer rotation) {
+ if (rotation == null) {
+ if (view3D.isSetRotY()) {
+ view3D.unsetRotY();
+ }
+ } else {
+ if (rotation < 0 || 360 < rotation) {
+ throw new IllegalArgumentException("rotation must be between 0 and 360");
+ }
+ if (view3D.isSetRotY()) {
+ view3D.getRotY().setVal(rotation);
+ } else {
+ view3D.addNewRotY().setVal(rotation);
+ }
+ }
+ }
+
+ public Boolean hasRightAngleAxes() {
+ if (view3D.isSetRAngAx()) {
+ return view3D.getRAngAx().getVal();
+ } else {
+ return null;
+ }
+ }
+
+ public void setRightAngleAxes(Boolean rightAngles) {
+ if (rightAngles == null) {
+ if (view3D.isSetRAngAx()) {
+ view3D.unsetRAngAx();
+ }
+ } else {
+ if (view3D.isSetRAngAx()) {
+ view3D.getRAngAx().setVal(rightAngles);
+ } else {
+ view3D.addNewRAngAx().setVal(rightAngles);
+ }
+ }
}
-
- public void setXRotationAngle(int val) {
- if (view3D.isSetRotY()) {
- view3D.getRotY().setVal(val);
- } else {
- view3D.addNewRotY().setVal(val);
- }
- }
-
- public int getYRotationAngle() {
- return view3D.getRotY().getVal();
+
+ public Short getPerspectiveAngle() {
+ if (view3D.isSetPerspective()) {
+ return view3D.getPerspective().getVal();
+ } else {
+ return null;
+ }
+ }
+
+ public void setPerspectiveAngle(Short perspective) {
+ if (perspective == null) {
+ if (view3D.isSetPerspective()) {
+ view3D.unsetPerspective();
+ }
+ } else {
+ if (perspective < 0 || 240 < perspective) {
+ throw new IllegalArgumentException("perspective must be between 0 and 240");
+ }
+ if (view3D.isSetPerspective()) {
+ view3D.getPerspective().setVal(perspective);
+ } else {
+ view3D.addNewPerspective().setVal(perspective);
+ }
+ }
}
-
- public void setYRotationAngle(int val) {
- if (view3D.isSetRotY()) {
- view3D.getRotY().setVal(val);
- } else {
- view3D.addNewRotY().setVal(val);
- }
- }
-
- public boolean getRightAngleAxes() {
- return view3D.getRAngAx().getVal();
+
+ public Integer getDepthPercent() {
+ if (view3D.isSetDepthPercent()) {
+ return view3D.getDepthPercent().getVal();
+ } else {
+ return null;
+ }
}
-
- public void setRightAngleAxes(boolean val) {
- if (view3D.isSetRAngAx()) {
- view3D.getRAngAx().setVal(val);
- } else {
- view3D.addNewRAngAx().setVal(val);
- }
- }
-
- public short getPerspectiveAngle() {
- return view3D.getPerspective().getVal();
+
+ public void setDepthPercent(Integer percent) {
+ if (percent == null) {
+ if (view3D.isSetDepthPercent()) {
+ view3D.unsetDepthPercent();
+ }
+ } else {
+ if (percent < 20 || 2000 < percent) {
+ throw new IllegalArgumentException("percent must be between 20 and 2000");
+ }
+ if (view3D.isSetDepthPercent()) {
+ view3D.getDepthPercent().setVal(percent);
+ } else {
+ view3D.addNewDepthPercent().setVal(percent);
+ }
+ }
}
-
- public void setPerspectiveAngle(short val) {
- if (view3D.isSetPerspective()) {
- view3D.getPerspective().setVal(val);
- } else {
- view3D.addNewPerspective().setVal(val);
- }
- }
-
- public int getDepthPercentVal() {
- return view3D.getDepthPercent().getVal();
+
+ public Integer getHPercent() {
+ if (view3D.isSetHPercent()) {
+ return view3D.getHPercent().getVal();
+ } else {
+ return null;
+ }
}
-
- public void setDepthPercent(int val) {
- if (view3D.isSetDepthPercent()) {
- view3D.getDepthPercent().setVal(val);
- } else {
- view3D.addNewDepthPercent().setVal(val);
- }
- }
-
- public int getHeightPercent() {
- return view3D.getHPercent().getVal();
+
+ public void setHPercent(Integer percent) {
+ if (percent == null) {
+ if (view3D.isSetHPercent()) {
+ view3D.unsetHPercent();
+ }
+ } else {
+ if (percent < 5 || 500 < percent) {
+ throw new IllegalArgumentException("percent must be between 5 and 500");
+ }
+ if (view3D.isSetHPercent()) {
+ view3D.getHPercent().setVal(percent);
+ } else {
+ view3D.addNewHPercent().setVal(percent);
+ }
+ }
}
-
- public void setHeightPercent(int val) {
- if (view3D.isSetHPercent()) {
- view3D.getHPercent().setVal(val);
- } else {
- view3D.addNewHPercent().setVal(val);
- }
- }
+
}
List<XDDFChartData> data = findChartData(chart);
XDDFPieChartData pie = (XDDFPieChartData) data.get(0);
- XDDFPieChartData.Series firstSeries = (XDDFPieChartData.Series) pie.getSeries().get(0);
- firstSeries.setExplosion(25);
- assertEquals(25, firstSeries.getExplosion());
+ XDDFPieChartData.Series firstSeries = (XDDFPieChartData.Series) pie.getSeries(0);
+ firstSeries.setExplosion(25L);
+ assertEquals(Long.valueOf(25), firstSeries.getExplosion());
fillChartData(chart, pie);
pptx.close();
XDDFBarChartData bar = (XDDFBarChartData) data.get(0);
assertEquals(BarDirection.BAR, bar.getBarDirection());
assertEquals(BarGrouping.CLUSTERED, bar.getBarGrouping());
- assertEquals(100, bar.getGapWidth());
+ assertEquals(Integer.valueOf(100), bar.getGapWidth());
fillChartData(chart, bar);
XDDFBarChartData column = (XDDFBarChartData) findChartData(chart2).get(0);
final String categoryDataRange = chart.formatRange(new CellRangeAddress(1, numOfPoints, 0, 0));
final String valuesDataRange = chart.formatRange(new CellRangeAddress(1, numOfPoints, 1, 1));
- final XDDFChartData.Series series = data.getSeries().get(0);
+ final XDDFChartData.Series series = data.getSeries(0);
final XDDFDataSource<?> categoryData = XDDFDataSourcesFactory.fromArray(categories, categoryDataRange);
final XDDFNumericalDataSource<Integer> valuesData = XDDFDataSourcesFactory.fromArray(values, valuesDataRange);
series.replaceData(categoryData, valuesData);
assertNotNull(read);
assertSheetOrder(read, "Sheet1-Renamed", "Sheet2", "Sheet3");
XSSFSheet sheet = (XSSFSheet) read.getSheet("Sheet1-Renamed");
- XDDFChartData.Series series = sheet.getDrawingPatriarch().getCharts().get(0).getChartSeries().get(0).getSeries().get(0);
+ XDDFChartData.Series series = sheet.getDrawingPatriarch().getCharts().get(0).getChartSeries().get(0).getSeries(0);
assertTrue("should be a bar chart data series", series instanceof XDDFBarChartData.Series);
String formula = ((XDDFBarChartData.Series) series).getCategoryData().getFormula();
assertTrue("should contain new sheet name", formula.startsWith("'Sheet1-Renamed'!"));
wb.close();
}
-
+
/**
* See bug #61700
* @throws Exception
Workbook workbook = _testDataProvider.createWorkbook();
workbook.createSheet().createRow(0).createCell(0).setCellFormula("B1+C1");
workbook.getCreationHelper().createFormulaEvaluator().evaluateAll();
-
+
assertFalse(workbook.getForceFormulaRecalculation());
workbook.setForceFormulaRecalculation(true);
assertTrue(workbook.getForceFormulaRecalculation());
-
+
Workbook wbBack = _testDataProvider.writeOutAndReadBack(workbook);
assertTrue(wbBack.getForceFormulaRecalculation());
-
+
workbook.close();
wbBack.close();
}