mirror of https://github.com/apache/poi.git
code cleanup plus fix for bug 63153
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1859590 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
af1dacfe2c
commit
093cbcfcca
|
@ -108,7 +108,7 @@ public class BarChartDemo {
|
|||
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);
|
||||
|
|
|
@ -98,10 +98,10 @@ public class PieChartDemo {
|
|||
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
|
||||
|
|
|
@ -144,16 +144,16 @@ public class BarAndLineChart {
|
|||
// 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);
|
||||
|
|
|
@ -110,7 +110,7 @@ public class BarChartExample {
|
|||
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);
|
||||
|
|
|
@ -52,7 +52,7 @@ public class XDDFLinearShadeProperties {
|
|||
}
|
||||
}
|
||||
|
||||
public Boolean getScaled() {
|
||||
public Boolean isScaled() {
|
||||
if (props.isSetScaled()) {
|
||||
return props.getScaled();
|
||||
} else {
|
||||
|
|
|
@ -0,0 +1,48 @@
|
|||
/* ====================================================================
|
||||
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);
|
||||
}
|
||||
}
|
|
@ -20,6 +20,7 @@ package org.apache.poi.xddf.usermodel.chart;
|
|||
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;
|
||||
|
@ -52,26 +53,70 @@ public class XDDFArea3DChartData extends XDDFChartData {
|
|||
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,
|
||||
|
@ -155,14 +200,14 @@ public class XDDFArea3DChartData extends XDDFChartData {
|
|||
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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,13 +20,11 @@ package org.apache.poi.xddf.usermodel.chart;
|
|||
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;
|
||||
|
||||
|
@ -55,26 +53,48 @@ public class XDDFAreaChartData extends XDDFChartData {
|
|||
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,
|
||||
|
@ -158,14 +178,14 @@ public class XDDFAreaChartData extends XDDFChartData {
|
|||
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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@ package org.apache.poi.xddf.usermodel.chart;
|
|||
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;
|
||||
|
@ -55,12 +56,24 @@ public class XDDFBar3DChartData extends XDDFChartData {
|
|||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -76,31 +89,87 @@ public class XDDFBar3DChartData extends XDDFChartData {
|
|||
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 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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 Shape getShape() {
|
||||
if (chart.isSetShape()) {
|
||||
return Shape.valueOf(chart.getShape().getVal());
|
||||
} else {
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -187,14 +256,14 @@ public class XDDFBar3DChartData extends XDDFChartData {
|
|||
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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@ package org.apache.poi.xddf.usermodel.chart;
|
|||
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;
|
||||
|
@ -55,12 +56,24 @@ public class XDDFBarChartData extends XDDFChartData {
|
|||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -76,31 +89,74 @@ public class XDDFBarChartData extends XDDFChartData {
|
|||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -187,15 +243,15 @@ public class XDDFBarChartData extends XDDFChartData {
|
|||
protected CTNumDataSource getNumDS() {
|
||||
return series.getVal();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void updateIdXVal(long val) {
|
||||
series.getIdx().setVal(val);
|
||||
protected void setIndex(long index) {
|
||||
series.getIdx().setVal(index);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setOrder(long order) {
|
||||
series.getOrder().setVal(order);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateOrderVal(long val) {
|
||||
series.getOrder().setVal(val);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,19 +57,26 @@ import org.apache.poi.xssf.usermodel.XSSFTable;
|
|||
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;
|
||||
|
@ -83,7 +90,7 @@ import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTTableColumns;
|
|||
|
||||
@Beta
|
||||
public abstract class XDDFChart extends POIXMLDocumentPart implements TextContainer {
|
||||
|
||||
|
||||
/**
|
||||
* default width of chart in emu
|
||||
*/
|
||||
|
@ -93,7 +100,7 @@ public abstract class XDDFChart extends POIXMLDocumentPart implements TextContai
|
|||
* default height of chart in emu
|
||||
*/
|
||||
public static final int DEFAULT_HEIGHT = 500000;
|
||||
|
||||
|
||||
/**
|
||||
* default x-coordinate of chart in emu
|
||||
*/
|
||||
|
@ -103,7 +110,7 @@ public abstract class XDDFChart extends POIXMLDocumentPart implements TextContai
|
|||
* default y-coordinate value of chart in emu
|
||||
*/
|
||||
public static final int DEFAULT_Y = 10;
|
||||
|
||||
|
||||
/**
|
||||
* Underlying workbook
|
||||
*/
|
||||
|
@ -390,21 +397,46 @@ public abstract class XDDFChart extends POIXMLDocumentPart implements TextContai
|
|||
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));
|
||||
|
@ -415,7 +447,17 @@ public abstract class XDDFChart extends POIXMLDocumentPart implements TextContai
|
|||
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;
|
||||
}
|
||||
|
||||
|
@ -453,7 +495,7 @@ public abstract class XDDFChart extends POIXMLDocumentPart implements TextContai
|
|||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
|
@ -502,13 +544,12 @@ public abstract class XDDFChart extends POIXMLDocumentPart implements TextContai
|
|||
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:
|
||||
|
@ -796,9 +837,9 @@ public abstract class XDDFChart extends POIXMLDocumentPart implements TextContai
|
|||
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);
|
||||
}
|
||||
|
|
|
@ -20,10 +20,12 @@ package org.apache.poi.xddf.usermodel.chart;
|
|||
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;
|
||||
|
@ -75,11 +77,62 @@ public abstract class XDDFChartData {
|
|||
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);
|
||||
|
@ -98,19 +151,9 @@ public abstract class XDDFChartData {
|
|||
|
||||
protected abstract CTNumDataSource getNumDS();
|
||||
|
||||
/**
|
||||
* This method will update series id value
|
||||
*
|
||||
* @param val
|
||||
*/
|
||||
public abstract void updateIdXVal(long val);
|
||||
protected abstract void setIndex(long index);
|
||||
|
||||
/**
|
||||
* this method will update series order value
|
||||
*
|
||||
* @param val
|
||||
*/
|
||||
public abstract void updateOrderVal(long val);
|
||||
protected abstract void setOrder(long order);
|
||||
|
||||
protected Series(XDDFDataSource<?> category, XDDFNumericalDataSource<? extends Number> values) {
|
||||
replaceData(category, values);
|
||||
|
|
|
@ -20,6 +20,7 @@ package org.apache.poi.xddf.usermodel.chart;
|
|||
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;
|
||||
|
@ -53,12 +54,24 @@ public class XDDFLine3DChartData extends XDDFChartData {
|
|||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -74,6 +87,28 @@ public class XDDFLine3DChartData extends XDDFChartData {
|
|||
}
|
||||
}
|
||||
|
||||
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) {
|
||||
|
@ -148,7 +183,7 @@ public class XDDFLine3DChartData extends XDDFChartData {
|
|||
}
|
||||
|
||||
|
||||
public Boolean getSmooth() {
|
||||
public Boolean isSmooth() {
|
||||
if (series.isSetSmooth()) {
|
||||
return series.getSmooth().getVal();
|
||||
} else {
|
||||
|
@ -217,14 +252,14 @@ public class XDDFLine3DChartData extends XDDFChartData {
|
|||
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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@ package org.apache.poi.xddf.usermodel.chart;
|
|||
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;
|
||||
|
@ -53,12 +54,24 @@ public class XDDFLineChartData extends XDDFChartData {
|
|||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -150,7 +163,7 @@ public class XDDFLineChartData extends XDDFChartData {
|
|||
/**
|
||||
* @since 4.0.1
|
||||
*/
|
||||
public Boolean getSmooth() {
|
||||
public Boolean isSmooth() {
|
||||
if (series.isSetSmooth()) {
|
||||
return series.getSmooth().getVal();
|
||||
} else {
|
||||
|
@ -219,14 +232,14 @@ public class XDDFLineChartData extends XDDFChartData {
|
|||
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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
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;
|
||||
|
@ -36,12 +37,24 @@ public class XDDFPie3DChartData extends XDDFChartData {
|
|||
}
|
||||
}
|
||||
|
||||
@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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -118,19 +131,25 @@ public class XDDFPie3DChartData extends XDDFChartData {
|
|||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -143,14 +162,14 @@ public class XDDFPie3DChartData extends XDDFChartData {
|
|||
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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
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;
|
||||
|
@ -36,12 +37,49 @@ public class XDDFPieChartData extends XDDFChartData {
|
|||
}
|
||||
}
|
||||
|
||||
@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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -118,19 +156,25 @@ public class XDDFPieChartData extends XDDFChartData {
|
|||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -143,14 +187,14 @@ public class XDDFPieChartData extends XDDFChartData {
|
|||
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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@ package org.apache.poi.xddf.usermodel.chart;
|
|||
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;
|
||||
|
@ -53,12 +54,24 @@ public class XDDFRadarChartData extends XDDFChartData {
|
|||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -156,15 +169,15 @@ public class XDDFRadarChartData extends XDDFChartData {
|
|||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@ package org.apache.poi.xddf.usermodel.chart;
|
|||
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;
|
||||
|
@ -54,12 +55,24 @@ public class XDDFScatterChartData extends XDDFChartData {
|
|||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -119,7 +132,7 @@ public class XDDFScatterChartData extends XDDFChartData {
|
|||
/**
|
||||
* @since 4.0.1
|
||||
*/
|
||||
public Boolean getSmooth() {
|
||||
public Boolean isSmooth() {
|
||||
if (series.isSetSmooth()) {
|
||||
return series.getSmooth().getVal();
|
||||
} else {
|
||||
|
@ -228,15 +241,15 @@ public class XDDFScatterChartData extends XDDFChartData {
|
|||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,9 +20,9 @@ package org.apache.poi.xddf.usermodel.chart;
|
|||
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;
|
||||
|
@ -52,35 +52,47 @@ public class XDDFSurface3DChartData extends XDDFChartData {
|
|||
}
|
||||
defineAxes(chart.getAxIdArray(), categories, values);
|
||||
}
|
||||
|
||||
public void setSeriesAxisId(XDDFSeriesAxis seriesAxis) {
|
||||
chart.addNewAxId().setVal(seriesAxis.getId());
|
||||
}
|
||||
|
||||
public CTBoolean getWireframe() {
|
||||
if (chart.isSetWireframe()) {
|
||||
return chart.getWireframe();
|
||||
} else {
|
||||
return chart.addNewWireframe();
|
||||
}
|
||||
}
|
||||
|
||||
public void setWireframe(boolean val) {
|
||||
if (chart.isSetWireframe()) {
|
||||
chart.getWireframe().setVal(val);
|
||||
} else {
|
||||
chart.addNewWireframe().setVal(val);
|
||||
}
|
||||
}
|
||||
@Internal
|
||||
@Override
|
||||
protected void removeCTSeries(int n) {
|
||||
chart.removeSer(n);
|
||||
}
|
||||
|
||||
/**
|
||||
* Surface chart is not supporting vary color property
|
||||
* Surface chart is not supporting vary color property.
|
||||
*/
|
||||
@Override
|
||||
public void setVaryColors(boolean varyColors) {
|
||||
|
||||
public void setVaryColors(Boolean varyColors) {
|
||||
// nothing to do
|
||||
}
|
||||
|
||||
public void defineSeriesAxis(XDDFSeriesAxis seriesAxis) {
|
||||
chart.addNewAxId().setVal(seriesAxis.getId());
|
||||
}
|
||||
|
||||
public Boolean isWireframe() {
|
||||
if (chart.isSetWireframe()) {
|
||||
return chart.getWireframe().getVal();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public void setWireframe(Boolean show) {
|
||||
if (show == null) {
|
||||
if (chart.isSetWireframe()) {
|
||||
chart.unsetWireframe();
|
||||
}
|
||||
} else {
|
||||
if (chart.isSetWireframe()) {
|
||||
chart.getWireframe().setVal(show);
|
||||
} else {
|
||||
chart.addNewWireframe().setVal(show);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public XDDFChartData.Series addSeries(XDDFDataSource<?> category,
|
||||
XDDFNumericalDataSource<? extends Number> values) {
|
||||
|
@ -119,11 +131,11 @@ public class XDDFSurface3DChartData extends XDDFChartData {
|
|||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
|
@ -159,14 +171,14 @@ public class XDDFSurface3DChartData extends XDDFChartData {
|
|||
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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,9 +20,9 @@ package org.apache.poi.xddf.usermodel.chart;
|
|||
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;
|
||||
|
@ -31,7 +31,6 @@ import org.openxmlformats.schemas.drawingml.x2006.chart.CTSurfaceSer;
|
|||
@Beta
|
||||
public class XDDFSurfaceChartData extends XDDFChartData {
|
||||
private CTSurfaceChart chart;
|
||||
|
||||
public XDDFSurfaceChartData(CTSurfaceChart chart, Map<Long, XDDFChartAxis> categories,
|
||||
Map<Long, XDDFValueAxis> values) {
|
||||
this.chart = chart;
|
||||
|
@ -40,6 +39,7 @@ public class XDDFSurfaceChartData extends XDDFChartData {
|
|||
}
|
||||
defineAxes(categories, values);
|
||||
}
|
||||
|
||||
private void defineAxes(Map<Long, XDDFChartAxis> categories, Map<Long, XDDFValueAxis> values) {
|
||||
if (chart.sizeOfAxIdArray() == 0) {
|
||||
for (Long id : categories.keySet()) {
|
||||
|
@ -52,34 +52,46 @@ public class XDDFSurfaceChartData extends XDDFChartData {
|
|||
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);
|
||||
}
|
||||
|
||||
public CTBoolean getWireframe() {
|
||||
if (chart.isSetWireframe()) {
|
||||
return chart.getWireframe();
|
||||
} else {
|
||||
return chart.addNewWireframe();
|
||||
}
|
||||
}
|
||||
|
||||
public void setWireframe(boolean val) {
|
||||
if (chart.isSetWireframe()) {
|
||||
chart.getWireframe().setVal(val);
|
||||
} else {
|
||||
chart.addNewWireframe().setVal(val);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Surface chart is not supporting vary color property
|
||||
* Surface chart is not supporting vary color property.
|
||||
*/
|
||||
@Override
|
||||
public void setVaryColors(boolean varyColors) {
|
||||
|
||||
public void setVaryColors(Boolean varyColors) {
|
||||
// nothing to do
|
||||
}
|
||||
|
||||
public void defineSeriesAxis(XDDFSeriesAxis seriesAxis) {
|
||||
chart.addNewAxId().setVal(seriesAxis.getId());
|
||||
}
|
||||
|
||||
public Boolean isWireframe() {
|
||||
if (chart.isSetWireframe()) {
|
||||
return chart.getWireframe().getVal();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public void setWireframe(Boolean show) {
|
||||
if (show == null) {
|
||||
if (chart.isSetWireframe()) {
|
||||
chart.unsetWireframe();
|
||||
}
|
||||
} else {
|
||||
if (chart.isSetWireframe()) {
|
||||
chart.getWireframe().setVal(show);
|
||||
} else {
|
||||
chart.addNewWireframe().setVal(show);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public XDDFChartData.Series addSeries(XDDFDataSource<?> category,
|
||||
XDDFNumericalDataSource<? extends Number> values) {
|
||||
|
@ -118,11 +130,11 @@ public class XDDFSurfaceChartData extends XDDFChartData {
|
|||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
|
@ -158,14 +170,14 @@ public class XDDFSurfaceChartData extends XDDFChartData {
|
|||
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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,85 +19,162 @@
|
|||
|
||||
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(int val) {
|
||||
if (view3D.isSetRotY()) {
|
||||
view3D.getRotY().setVal(val);
|
||||
} else {
|
||||
view3D.addNewRotY().setVal(val);
|
||||
}
|
||||
}
|
||||
|
||||
public int getYRotationAngle() {
|
||||
return view3D.getRotY().getVal();
|
||||
|
||||
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 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 getYRotationAngle() {
|
||||
if (view3D.isSetRotY()) {
|
||||
return view3D.getRotY().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 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 void setPerspectiveAngle(short val) {
|
||||
if (view3D.isSetPerspective()) {
|
||||
view3D.getPerspective().setVal(val);
|
||||
} else {
|
||||
view3D.addNewPerspective().setVal(val);
|
||||
}
|
||||
}
|
||||
|
||||
public int getDepthPercentVal() {
|
||||
return view3D.getDepthPercent().getVal();
|
||||
|
||||
public Boolean hasRightAngleAxes() {
|
||||
if (view3D.isSetRAngAx()) {
|
||||
return view3D.getRAngAx().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 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 setHeightPercent(int val) {
|
||||
if (view3D.isSetHPercent()) {
|
||||
view3D.getHPercent().setVal(val);
|
||||
} else {
|
||||
view3D.addNewHPercent().setVal(val);
|
||||
}
|
||||
}
|
||||
|
||||
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 Integer getDepthPercent() {
|
||||
if (view3D.isSetDepthPercent()) {
|
||||
return view3D.getDepthPercent().getVal();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
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 Integer getHPercent() {
|
||||
if (view3D.isSetHPercent()) {
|
||||
return view3D.getHPercent().getVal();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -67,9 +67,9 @@ public class TestXSLFChart {
|
|||
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();
|
||||
|
@ -87,7 +87,7 @@ public class TestXSLFChart {
|
|||
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);
|
||||
|
@ -153,7 +153,7 @@ public class TestXSLFChart {
|
|||
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);
|
||||
|
|
|
@ -713,7 +713,7 @@ public final class TestXSSFWorkbook extends BaseTestXWorkbook {
|
|||
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'!"));
|
||||
|
@ -1142,7 +1142,7 @@ public final class TestXSSFWorkbook extends BaseTestXWorkbook {
|
|||
|
||||
wb.close();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* See bug #61700
|
||||
* @throws Exception
|
||||
|
@ -1152,14 +1152,14 @@ public final class TestXSSFWorkbook extends BaseTestXWorkbook {
|
|||
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();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue