git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1879276 13f79535-47bb-0310-9956-ffa450edef68tags/before_ooxml_3rd_edition
@@ -18,7 +18,6 @@ | |||
package org.apache.poi.ss.usermodel; | |||
import org.apache.poi.ss.formula.eval.ErrorEval; | |||
import org.apache.poi.util.Removal; | |||
/** | |||
* Mimics the 'data view' of a cell. This allows formula evaluator | |||
@@ -27,7 +26,7 @@ import org.apache.poi.util.Removal; | |||
*/ | |||
public final class CellValue { | |||
public static final CellValue TRUE = new CellValue(CellType.BOOLEAN, 0.0, true, null, 0); | |||
public static final CellValue FALSE= new CellValue(CellType.BOOLEAN, 0.0, false, null, 0); | |||
public static final CellValue FALSE = new CellValue(CellType.BOOLEAN, 0.0, false, null, 0); | |||
private final CellType _cellType; | |||
private final double _numberValue; | |||
@@ -83,17 +82,6 @@ public final class CellValue { | |||
return _textValue; | |||
} | |||
/** | |||
* Return the cell type. | |||
* | |||
* @return the cell type | |||
* @since POI 3.15 | |||
* @deprecated use <code>getCellType</code> instead | |||
*/ | |||
@Deprecated | |||
@Removal(version="4.2") | |||
public CellType getCellTypeEnum() { return getCellType(); } | |||
/** | |||
* Return the cell type. | |||
* |
@@ -1,70 +0,0 @@ | |||
/* ==================================================================== | |||
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.ss.usermodel; | |||
import java.util.List; | |||
import org.apache.poi.ss.usermodel.charts.ChartAxis; | |||
import org.apache.poi.ss.usermodel.charts.ChartAxisFactory; | |||
import org.apache.poi.ss.usermodel.charts.ChartData; | |||
import org.apache.poi.ss.usermodel.charts.ChartDataFactory; | |||
import org.apache.poi.ss.usermodel.charts.ChartLegend; | |||
import org.apache.poi.ss.usermodel.charts.ManuallyPositionable; | |||
import org.apache.poi.util.Removal; | |||
/** | |||
* High level representation of a chart. | |||
* | |||
* @deprecated | |||
*/ | |||
@Deprecated | |||
@Removal(version="4.2") | |||
public interface Chart extends ManuallyPositionable { | |||
/** | |||
* @return an appropriate ChartDataFactory implementation | |||
*/ | |||
ChartDataFactory getChartDataFactory(); | |||
/** | |||
* @return an appropriate ChartAxisFactory implementation | |||
*/ | |||
ChartAxisFactory getChartAxisFactory(); | |||
/** | |||
* @return chart legend instance | |||
*/ | |||
ChartLegend getOrCreateLegend(); | |||
/** | |||
* Delete current chart legend. | |||
*/ | |||
void deleteLegend(); | |||
/** | |||
* @return list of all chart axis | |||
*/ | |||
List<? extends ChartAxis> getAxis(); | |||
/** | |||
* Plots specified data on the chart. | |||
* | |||
* @param data a data to plot | |||
*/ | |||
void plot(ChartData data, ChartAxis... axis); | |||
} |
@@ -1,40 +0,0 @@ | |||
/* ==================================================================== | |||
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.ss.usermodel.charts; | |||
import org.apache.poi.util.Removal; | |||
/** | |||
* Specifies the possible crossing states of an axis. | |||
* | |||
* @deprecated use XDDF AxisCrossBetween | |||
*/ | |||
@Deprecated | |||
@Removal(version="4.2") | |||
public enum AxisCrossBetween { | |||
/** | |||
* Specifies the value axis shall cross the category axis | |||
* between data markers. | |||
*/ | |||
BETWEEN, | |||
/** | |||
* Specifies the value axis shall cross the category axis at | |||
* the midpoint of a category. | |||
*/ | |||
MIDPOINT_CATEGORY | |||
} |
@@ -1,44 +0,0 @@ | |||
/* ==================================================================== | |||
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.ss.usermodel.charts; | |||
import org.apache.poi.util.Removal; | |||
/** | |||
* Specifies the possible crossing points for an axis. | |||
* | |||
* @deprecated use XDDF AxisCrosses instead | |||
*/ | |||
@Deprecated | |||
@Removal(version="4.2") | |||
public enum AxisCrosses { | |||
/** | |||
* The category axis crosses at the zero point of the value axis (if | |||
* possible), or the minimum value (if the minimum is greater than zero) or | |||
* the maximum (if the maximum is less than zero). | |||
*/ | |||
AUTO_ZERO, | |||
/** | |||
* The axis crosses at the maximum value. | |||
*/ | |||
MIN, | |||
/** | |||
* Axis crosses at the minimum value of the chart. | |||
*/ | |||
MAX | |||
} |
@@ -1,40 +0,0 @@ | |||
/* ==================================================================== | |||
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.ss.usermodel.charts; | |||
import org.apache.poi.util.Removal; | |||
/** | |||
* Specifies the possible ways to place a picture on a data point, series, wall, or floor. | |||
* | |||
* @deprecated use XDDF AxisOrientation | |||
*/ | |||
@Deprecated | |||
@Removal(version="4.2") | |||
public enum AxisOrientation { | |||
/** | |||
* Specifies that the values on the axis shall be reversed | |||
* so they go from maximum to minimum. | |||
*/ | |||
MAX_MIN, | |||
/** | |||
* Specifies that the axis values shall be in the usual | |||
* order, minimum to maximum. | |||
*/ | |||
MIN_MAX | |||
} |
@@ -1,34 +0,0 @@ | |||
/* ==================================================================== | |||
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.ss.usermodel.charts; | |||
import org.apache.poi.util.Removal; | |||
/** | |||
* Enumeration of all possible axis positions. | |||
* | |||
* @deprecated use XDDF AxisPosition instead | |||
*/ | |||
@Deprecated | |||
@Removal(version="4.2") | |||
public enum AxisPosition { | |||
BOTTOM, | |||
LEFT, | |||
RIGHT, | |||
TOP | |||
} |
@@ -1,34 +0,0 @@ | |||
/* ==================================================================== | |||
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.ss.usermodel.charts; | |||
import org.apache.poi.util.Removal; | |||
/** | |||
* Enumeration of possible axis tick marks. | |||
* | |||
* @deprecated use XDDF AxisTickMark instead | |||
*/ | |||
@Deprecated | |||
@Removal(version="4.2") | |||
public enum AxisTickMark { | |||
NONE, | |||
CROSS, | |||
IN, | |||
OUT | |||
} |
@@ -1,163 +0,0 @@ | |||
/* ==================================================================== | |||
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.ss.usermodel.charts; | |||
import org.apache.poi.util.Removal; | |||
/** | |||
* High level representation of chart axis. | |||
* | |||
* @deprecated use XDDFChartAxis instead | |||
*/ | |||
@Deprecated | |||
@Removal(version="4.2") | |||
public interface ChartAxis { | |||
/** | |||
* @return axis id | |||
*/ | |||
long getId(); | |||
/** | |||
* @return axis position | |||
*/ | |||
AxisPosition getPosition(); | |||
/** | |||
* @param position new axis position | |||
*/ | |||
void setPosition(AxisPosition position); | |||
/** | |||
* @return axis number format | |||
*/ | |||
String getNumberFormat(); | |||
/** | |||
* @param format axis number format | |||
*/ | |||
void setNumberFormat(String format); | |||
/** | |||
* @return true if log base is defined, false otherwise | |||
*/ | |||
boolean isSetLogBase(); | |||
/** | |||
* @param logBase a number between 2 and 1000 (inclusive) | |||
* @throws IllegalArgumentException if log base not within allowed range | |||
*/ | |||
void setLogBase(double logBase); | |||
/** | |||
* @return axis log base or 0.0 if not set | |||
*/ | |||
double getLogBase(); | |||
/** | |||
* @return true if minimum value is defined, false otherwise | |||
*/ | |||
boolean isSetMinimum(); | |||
/** | |||
* @return axis minimum or 0.0 if not set | |||
*/ | |||
double getMinimum(); | |||
/** | |||
* @param min axis minimum | |||
*/ | |||
void setMinimum(double min); | |||
/** | |||
* @return true if maximum value is defined, false otherwise | |||
*/ | |||
boolean isSetMaximum(); | |||
/** | |||
* @return axis maximum or 0.0 if not set | |||
*/ | |||
double getMaximum(); | |||
/** | |||
* @param max axis maximum | |||
*/ | |||
void setMaximum(double max); | |||
/** | |||
* @return axis orientation | |||
*/ | |||
AxisOrientation getOrientation(); | |||
/** | |||
* @param orientation axis orientation | |||
*/ | |||
void setOrientation(AxisOrientation orientation); | |||
/** | |||
* @param crosses axis cross type | |||
*/ | |||
void setCrosses(AxisCrosses crosses); | |||
/** | |||
* @return axis cross type | |||
*/ | |||
AxisCrosses getCrosses(); | |||
/** | |||
* Declare this axis cross another axis. | |||
* @param axis that this axis should cross | |||
*/ | |||
void crossAxis(ChartAxis axis); | |||
/** | |||
* @return visibility of the axis. | |||
*/ | |||
boolean isVisible(); | |||
/** | |||
* @param value visibility of the axis. | |||
*/ | |||
void setVisible(boolean value); | |||
/** | |||
* @return major tick mark. | |||
*/ | |||
AxisTickMark getMajorTickMark(); | |||
/** | |||
* @param tickMark major tick mark type. | |||
*/ | |||
void setMajorTickMark(AxisTickMark tickMark); | |||
/** | |||
* @return minor tick mark. | |||
*/ | |||
AxisTickMark getMinorTickMark(); | |||
/** | |||
* @param tickMark minor tick mark type. | |||
*/ | |||
void setMinorTickMark(AxisTickMark tickMark); | |||
/** | |||
* Use this to check before retrieving a number format, as calling {@link #getNumberFormat()} may create a default one if none exists. | |||
* @return true if a number format element is defined, false if not | |||
*/ | |||
boolean hasNumberFormat(); | |||
} |
@@ -1,49 +0,0 @@ | |||
/* ==================================================================== | |||
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.ss.usermodel.charts; | |||
import org.apache.poi.util.Removal; | |||
/** | |||
* A factory for different chart axis. | |||
* | |||
* @deprecated | |||
*/ | |||
@Deprecated | |||
@Removal(version="4.2") | |||
public interface ChartAxisFactory { | |||
/** | |||
* @param pos | |||
* @return new value axis at the end of the list at the specified chart position | |||
*/ | |||
ValueAxis createValueAxis(AxisPosition pos); | |||
/** | |||
* @param pos | |||
* @return new category axis at the end of the list at the specified chart position | |||
*/ | |||
ChartAxis createCategoryAxis(AxisPosition pos); | |||
/** | |||
* @param pos | |||
* @return new date category axis at the end of the list at the specified chart position | |||
*/ | |||
ChartAxis createDateAxis(AxisPosition pos); | |||
} |
@@ -1,39 +0,0 @@ | |||
/* ==================================================================== | |||
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.ss.usermodel.charts; | |||
import org.apache.poi.ss.usermodel.Chart; | |||
import org.apache.poi.util.Removal; | |||
/** | |||
* A base for all charts data types. | |||
* | |||
* @deprecated use XDDFChartData instead | |||
*/ | |||
@Deprecated | |||
@Removal(version="4.2") | |||
public interface ChartData { | |||
/** | |||
* Fills a charts with data specified by implementation. | |||
* | |||
* @param chart a charts to fill in | |||
* @param axis charts axis to use | |||
*/ | |||
void fillChart(Chart chart, ChartAxis... axis); | |||
} |
@@ -1,41 +0,0 @@ | |||
/* ==================================================================== | |||
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.ss.usermodel.charts; | |||
import org.apache.poi.util.Removal; | |||
/** | |||
* A factory for different charts data types. | |||
* | |||
* @deprecated | |||
*/ | |||
@Deprecated | |||
@Removal(version="4.2") | |||
public interface ChartDataFactory { | |||
/** | |||
* @return an appropriate ScatterChartData instance | |||
*/ | |||
ScatterChartData createScatterChartData(); | |||
/** | |||
* @return a LineChartData instance | |||
*/ | |||
LineChartData createLineChartData(); | |||
} |
@@ -1,73 +0,0 @@ | |||
/* | |||
* ==================================================================== | |||
* 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.ss.usermodel.charts; | |||
import org.apache.poi.util.Removal; | |||
/** | |||
* Represents data model of the charts. | |||
* | |||
* @param <T> type of points the data source contents | |||
* @deprecated use XDDFDataSource instead | |||
*/ | |||
@Deprecated | |||
@Removal(version="4.2") | |||
public interface ChartDataSource<T> { | |||
/** | |||
* Return number of points contained by data source. | |||
* | |||
* @return number of points contained by data source | |||
*/ | |||
int getPointCount(); | |||
/** | |||
* Returns point value at specified index. | |||
* | |||
* @param index index to value from | |||
* @return point value at specified index. | |||
* @throws {@code IndexOutOfBoundsException} if index | |||
* parameter not in range {@code 0 <= index <= pointCount} | |||
*/ | |||
T getPointAt(int index); | |||
/** | |||
* Returns {@code true} if charts data source is valid cell range. | |||
* | |||
* @return {@code true} if charts data source is valid cell range | |||
*/ | |||
boolean isReference(); | |||
/** | |||
* Returns {@code true} if data source points should be treated as numbers. | |||
* | |||
* @return {@code true} if data source points should be treated as numbers | |||
*/ | |||
boolean isNumeric(); | |||
/** | |||
* Returns formula representation of the data source. It is only applicable | |||
* for data source that is valid cell range. | |||
* | |||
* @return formula representation of the data source | |||
* @throws {@code UnsupportedOperationException} if the data source is not a | |||
* reference. | |||
*/ | |||
String getFormulaString(); | |||
} |
@@ -1,55 +0,0 @@ | |||
/* ==================================================================== | |||
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.ss.usermodel.charts; | |||
import org.apache.poi.util.Removal; | |||
/** | |||
* High level representation of chart legend. | |||
* | |||
* @deprecated use XDDFChartLegend instead | |||
*/ | |||
@Deprecated | |||
@Removal(version="4.2") | |||
public interface ChartLegend extends ManuallyPositionable { | |||
/** | |||
* @return legend position | |||
*/ | |||
LegendPosition getPosition(); | |||
/** | |||
* @param position new legend position | |||
*/ | |||
void setPosition(LegendPosition position); | |||
/** | |||
* @return overlay value. | |||
*/ | |||
boolean isOverlay(); | |||
/** | |||
* If true the legend is positioned over the chart area otherwise | |||
* the legend is displayed next to it. | |||
* | |||
* Default is no overlay. | |||
* | |||
* @param value | |||
*/ | |||
void setOverlay(boolean value); | |||
} |
@@ -1,59 +0,0 @@ | |||
/* ==================================================================== | |||
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.ss.usermodel.charts; | |||
import org.apache.poi.ss.util.CellReference; | |||
import org.apache.poi.util.Removal; | |||
/** | |||
* Basic settings for all chart series. | |||
* @deprecated | |||
*/ | |||
@Deprecated | |||
@Removal(version="4.2") | |||
public interface ChartSeries { | |||
/** | |||
* Sets the title of the series as a string literal. | |||
* | |||
* @param title | |||
*/ | |||
void setTitle(String title); | |||
/** | |||
* Sets the title of the series as a cell reference. | |||
* | |||
* @param titleReference | |||
*/ | |||
void setTitle(CellReference titleReference); | |||
/** | |||
* @return title as string literal. | |||
*/ | |||
String getTitleString(); | |||
/** | |||
* @return title as cell reference. | |||
*/ | |||
CellReference getTitleCellReference(); | |||
/** | |||
* @return title type. | |||
*/ | |||
TitleType getTitleType(); | |||
} |
@@ -1,163 +0,0 @@ | |||
/* | |||
* ==================================================================== | |||
* 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.ss.usermodel.charts; | |||
import org.apache.poi.ss.usermodel.CellType; | |||
import org.apache.poi.ss.usermodel.CellValue; | |||
import org.apache.poi.ss.usermodel.FormulaEvaluator; | |||
import org.apache.poi.ss.usermodel.Row; | |||
import org.apache.poi.ss.usermodel.Sheet; | |||
import org.apache.poi.ss.util.CellRangeAddress; | |||
import org.apache.poi.util.Removal; | |||
/** | |||
* Class {@code DataSources} is a factory for {@link ChartDataSource} instances. | |||
* | |||
*@deprecated use XDDFDataSourcesFactory instead | |||
*/ | |||
@Deprecated | |||
@Removal(version="4.2") | |||
public class DataSources { | |||
private DataSources() { | |||
} | |||
public static <T> ChartDataSource<T> fromArray(T[] elements) { | |||
return new ArrayDataSource<>(elements); | |||
} | |||
public static ChartDataSource<Number> fromNumericCellRange(Sheet sheet, CellRangeAddress cellRangeAddress) { | |||
return new AbstractCellRangeDataSource<Number>(sheet, cellRangeAddress) { | |||
@Override | |||
public Number getPointAt(int index) { | |||
CellValue cellValue = getCellValueAt(index); | |||
if (cellValue != null && cellValue.getCellType() == CellType.NUMERIC) { | |||
return Double.valueOf(cellValue.getNumberValue()); | |||
} else { | |||
return null; | |||
} | |||
} | |||
@Override | |||
public boolean isNumeric() { | |||
return true; | |||
} | |||
}; | |||
} | |||
public static ChartDataSource<String> fromStringCellRange(Sheet sheet, CellRangeAddress cellRangeAddress) { | |||
return new AbstractCellRangeDataSource<String>(sheet, cellRangeAddress) { | |||
@Override | |||
public String getPointAt(int index) { | |||
CellValue cellValue = getCellValueAt(index); | |||
if (cellValue != null && cellValue.getCellType() == CellType.STRING) { | |||
return cellValue.getStringValue(); | |||
} else { | |||
return null; | |||
} | |||
} | |||
@Override | |||
public boolean isNumeric() { | |||
return false; | |||
} | |||
}; | |||
} | |||
private static class ArrayDataSource<T> implements ChartDataSource<T> { | |||
private final T[] elements; | |||
public ArrayDataSource(T[] elements) { | |||
this.elements = elements.clone(); | |||
} | |||
@Override | |||
public int getPointCount() { | |||
return elements.length; | |||
} | |||
@Override | |||
public T getPointAt(int index) { | |||
return elements[index]; | |||
} | |||
@Override | |||
public boolean isReference() { | |||
return false; | |||
} | |||
@Override | |||
public boolean isNumeric() { | |||
Class<?> arrayComponentType = elements.getClass().getComponentType(); | |||
return (Number.class.isAssignableFrom(arrayComponentType)); | |||
} | |||
@Override | |||
public String getFormulaString() { | |||
throw new UnsupportedOperationException("Literal data source can not be expressed by reference."); | |||
} | |||
} | |||
private abstract static class AbstractCellRangeDataSource<T> implements ChartDataSource<T> { | |||
private final Sheet sheet; | |||
private final CellRangeAddress cellRangeAddress; | |||
private final int numOfCells; | |||
private FormulaEvaluator evaluator; | |||
protected AbstractCellRangeDataSource(Sheet sheet, CellRangeAddress cellRangeAddress) { | |||
this.sheet = sheet; | |||
// Make copy since CellRangeAddress is mutable. | |||
this.cellRangeAddress = cellRangeAddress.copy(); | |||
this.numOfCells = this.cellRangeAddress.getNumberOfCells(); | |||
this.evaluator = sheet.getWorkbook().getCreationHelper().createFormulaEvaluator(); | |||
} | |||
@Override | |||
public int getPointCount() { | |||
return numOfCells; | |||
} | |||
@Override | |||
public boolean isReference() { | |||
return true; | |||
} | |||
@Override | |||
public String getFormulaString() { | |||
return cellRangeAddress.formatAsString(sheet.getSheetName(), true); | |||
} | |||
protected CellValue getCellValueAt(int index) { | |||
if (index < 0 || index >= numOfCells) { | |||
throw new IndexOutOfBoundsException("Index must be between 0 and " + | |||
(numOfCells - 1) + " (inclusive), given: " + index); | |||
} | |||
int firstRow = cellRangeAddress.getFirstRow(); | |||
int firstCol = cellRangeAddress.getFirstColumn(); | |||
int lastCol = cellRangeAddress.getLastColumn(); | |||
int width = lastCol - firstCol + 1; | |||
int rowIndex = firstRow + index / width; | |||
int cellIndex = firstCol + index % width; | |||
Row row = sheet.getRow(rowIndex); | |||
return (row == null) ? null : evaluator.evaluate(row.getCell(cellIndex)); | |||
} | |||
} | |||
} |
@@ -1,39 +0,0 @@ | |||
/* ==================================================================== | |||
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.ss.usermodel.charts; | |||
import org.apache.poi.util.Removal; | |||
/** | |||
* Specifies the possible ways to store a chart element's position. | |||
* @see org.apache.poi.xddf.usermodel.chart.LayoutMode XDDF LayoutMode instead | |||
*/ | |||
@Deprecated | |||
@Removal(version="4.2") | |||
public enum LayoutMode { | |||
/** | |||
* Specifies that the Width or Height shall be interpreted as the | |||
* Right or Bottom of the chart element. | |||
*/ | |||
EDGE, | |||
/** | |||
* Specifies that the Width or Height shall be interpreted as the | |||
* Width or Height of the chart element. | |||
*/ | |||
FACTOR | |||
} |
@@ -1,43 +0,0 @@ | |||
/* ==================================================================== | |||
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.ss.usermodel.charts; | |||
import org.apache.poi.util.Removal; | |||
/** | |||
* Specifies whether to layout the plot area by its inside (not including axis | |||
* and axis labels) or outside (including axis and axis labels). | |||
* | |||
* @deprecated use XDDF LayoutTarget instead | |||
*/ | |||
@Deprecated | |||
@Removal(version="4.2") | |||
public enum LayoutTarget { | |||
/** | |||
* Specifies that the plot area size shall determine the | |||
* size of the plot area, not including the tick marks and | |||
* axis labels. | |||
*/ | |||
INNER, | |||
/** | |||
* Specifies that the plot area size shall determine the | |||
* size of the plot area, the tick marks, and the axis | |||
* labels. | |||
*/ | |||
OUTER | |||
} |
@@ -1,35 +0,0 @@ | |||
/* ==================================================================== | |||
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.ss.usermodel.charts; | |||
import org.apache.poi.util.Removal; | |||
/** | |||
* Enumeration of all possible chart legend positions. | |||
* | |||
* @deprecated use XDDF LayoutPosition instead | |||
*/ | |||
@Deprecated | |||
@Removal(version="4.2") | |||
public enum LegendPosition { | |||
BOTTOM, | |||
LEFT, | |||
RIGHT, | |||
TOP, | |||
TOP_RIGHT | |||
} |
@@ -1,44 +0,0 @@ | |||
/* ==================================================================== | |||
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.ss.usermodel.charts; | |||
import java.util.List; | |||
import org.apache.poi.util.Removal; | |||
/** | |||
* Data for a Line Chart | |||
* | |||
* @deprecated use XDDFLineChartData instead | |||
*/ | |||
@Deprecated | |||
@Removal(version="4.2") | |||
public interface LineChartData extends ChartData { | |||
/** | |||
* @param categories data source for categories. | |||
* @param values data source for values. | |||
* @return a new line chart serie. | |||
*/ | |||
LineChartSeries addSeries(ChartDataSource<?> categories, ChartDataSource<? extends Number> values); | |||
/** | |||
* @return list of all series. | |||
*/ | |||
List<? extends LineChartSeries> getSeries(); | |||
} |
@@ -1,41 +0,0 @@ | |||
/* ==================================================================== | |||
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.ss.usermodel.charts; | |||
import org.apache.poi.util.Removal; | |||
/** | |||
* Represents a line chart series. | |||
* | |||
* @deprecated use XDDFLineChartData.Series instead | |||
*/ | |||
@Deprecated | |||
@Removal(version="4.2") | |||
public interface LineChartSeries extends ChartSeries { | |||
/** | |||
* @return data source used for category axis data. | |||
*/ | |||
ChartDataSource<?> getCategoryAxisData(); | |||
/** | |||
* @return data source used for value axis. | |||
*/ | |||
ChartDataSource<? extends Number> getValues(); | |||
} |
@@ -1,154 +0,0 @@ | |||
/* ==================================================================== | |||
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.ss.usermodel.charts; | |||
import org.apache.poi.util.Removal; | |||
/** | |||
* High level representation of chart element manual layout. | |||
* | |||
* @deprecated use XDDFManualLayout instead | |||
*/ | |||
@Deprecated | |||
@Removal(version="4.2") | |||
public interface ManualLayout { | |||
/** | |||
* Sets the layout target. | |||
* @param target new layout target. | |||
*/ | |||
public void setTarget(LayoutTarget target); | |||
/** | |||
* Returns current layout target. | |||
* @return current layout target | |||
*/ | |||
public LayoutTarget getTarget(); | |||
/** | |||
* Sets the x-coordinate layout mode. | |||
* @param mode new x-coordinate layout mode. | |||
*/ | |||
public void setXMode(LayoutMode mode); | |||
/** | |||
* Returns current x-coordinnate layout mode. | |||
* @return current x-coordinate layout mode. | |||
*/ | |||
public LayoutMode getXMode(); | |||
/** | |||
* Sets the y-coordinate layout mode. | |||
* @param mode new y-coordinate layout mode. | |||
*/ | |||
public void setYMode(LayoutMode mode); | |||
/** | |||
* Returns current y-coordinate layout mode. | |||
* @return current y-coordinate layout mode. | |||
*/ | |||
public LayoutMode getYMode(); | |||
/** | |||
* Returns the x location of the chart element. | |||
* @return the x location (left) of the chart element or 0.0 if | |||
* not set. | |||
*/ | |||
public double getX(); | |||
/** | |||
* Specifies the x location (left) of the chart element as a | |||
* fraction of the width of the chart. If Left Mode is Factor, | |||
* then the position is relative to the default position for the | |||
* chart element. | |||
*/ | |||
public void setX(double x); | |||
/** | |||
* Returns current y location of the chart element. | |||
* @return the y location (top) of the chart element or 0.0 if not | |||
* set. | |||
*/ | |||
public double getY(); | |||
/** | |||
* Specifies the y location (top) of the chart element as a | |||
* fraction of the height of the chart. If Top Mode is Factor, | |||
* then the position is relative to the default position for the | |||
* chart element. | |||
*/ | |||
public void setY(double y); | |||
/** | |||
* Specifies how to interpret the Width element for this manual | |||
* layout. | |||
* @param mode new width layout mode of this manual layout. | |||
*/ | |||
public void setWidthMode(LayoutMode mode); | |||
/** | |||
* Returns current width mode of this manual layout. | |||
* @return width mode of this manual layout. | |||
*/ | |||
public LayoutMode getWidthMode(); | |||
/** | |||
* Specifies how to interpret the Height element for this manual | |||
* layout. | |||
* @param mode new height mode of this manual layout. | |||
*/ | |||
public void setHeightMode(LayoutMode mode); | |||
/** | |||
* Returns current height mode of this | |||
* @return height mode of this manual layout. | |||
*/ | |||
public LayoutMode getHeightMode(); | |||
/** | |||
* Specifies the width (if Width Mode is Factor) or right (if | |||
* Width Mode is Edge) of the chart element as a fraction of the | |||
* width of the chart. | |||
* @param ratio a fraction of the width of the chart. | |||
*/ | |||
public void setWidthRatio(double ratio); | |||
/** | |||
* Returns current fraction of the width of the chart. | |||
* @return fraction of the width of the chart or 0.0 if not set. | |||
*/ | |||
public double getWidthRatio(); | |||
/** | |||
* Specifies the height (if Height Mode is Factor) or bottom (if | |||
* Height Mode is edge) of the chart element as a fraction of the | |||
* height of the chart. | |||
* @param ratio a fraction of the height of the chart. | |||
*/ | |||
public void setHeightRatio(double ratio); | |||
/** | |||
* Returns current fraction of the height of the chart. | |||
* @return fraction of the height of the chart or 0.0 if not set. | |||
*/ | |||
public double getHeightRatio(); | |||
} |
@@ -1,37 +0,0 @@ | |||
/* ==================================================================== | |||
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.ss.usermodel.charts; | |||
import org.apache.poi.util.Removal; | |||
/** | |||
* Abstraction of chart element that can be positioned with manual | |||
* layout. | |||
* | |||
* @deprecated | |||
*/ | |||
@Deprecated | |||
@Removal(version="4.2") | |||
public interface ManuallyPositionable { | |||
/** | |||
* Returns manual layout for the chart element. | |||
* @return manual layout for the chart element. | |||
*/ | |||
public ManualLayout getManualLayout(); | |||
} |
@@ -1,43 +0,0 @@ | |||
/* ==================================================================== | |||
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.ss.usermodel.charts; | |||
import java.util.List; | |||
import org.apache.poi.util.Removal; | |||
/** | |||
* Data for a Scatter Chart | |||
* | |||
* @deprecated use XDDFScatterChartData instead | |||
*/ | |||
@Deprecated | |||
@Removal(version="4.2") | |||
public interface ScatterChartData extends ChartData { | |||
/** | |||
* @param xs data source to be used for X axis values | |||
* @param ys data source to be used for Y axis values | |||
* @return a new scatter charts series | |||
*/ | |||
ScatterChartSeries addSerie(ChartDataSource<?> xs, ChartDataSource<? extends Number> ys); | |||
/** | |||
* @return list of all series | |||
*/ | |||
List<? extends ScatterChartSeries> getSeries(); | |||
} |
@@ -1,41 +0,0 @@ | |||
/* ==================================================================== | |||
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.ss.usermodel.charts; | |||
import org.apache.poi.util.Removal; | |||
/** | |||
* Represents scatter charts series. | |||
* | |||
* @deprecated use XDFFScatterChartData.Series instead | |||
*/ | |||
@Deprecated | |||
@Removal(version="4.2") | |||
public interface ScatterChartSeries extends ChartSeries { | |||
/** | |||
* @return data source used for X axis values | |||
*/ | |||
ChartDataSource<?> getXValues(); | |||
/** | |||
* @return data source used for Y axis values | |||
*/ | |||
ChartDataSource<? extends Number> getYValues(); | |||
} |
@@ -1,32 +0,0 @@ | |||
/* ==================================================================== | |||
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.ss.usermodel.charts; | |||
import org.apache.poi.util.Removal; | |||
/** | |||
* Title types for charts. | |||
* | |||
* @deprecated | |||
*/ | |||
@Deprecated | |||
@Removal(version="4.2") | |||
public enum TitleType { | |||
STRING, | |||
CELL_REFERENCE | |||
} |
@@ -1,38 +0,0 @@ | |||
/* ==================================================================== | |||
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.ss.usermodel.charts; | |||
import org.apache.poi.util.Removal; | |||
/** | |||
* @deprecated use XDDFValueAxis instead | |||
*/ | |||
@Deprecated | |||
@Removal(version="4.2") | |||
public interface ValueAxis extends ChartAxis { | |||
/** | |||
* @return cross between type | |||
*/ | |||
AxisCrossBetween getCrossBetween(); | |||
/** | |||
* @param crossBetween cross between type | |||
*/ | |||
void setCrossBetween(AxisCrossBetween crossBetween); | |||
} |
@@ -54,7 +54,7 @@ public final class TestAreas { | |||
cell.setCellFormula(formulaText); | |||
fe.notifyUpdateCell(cell); | |||
CellValue result = fe.evaluate(cell); | |||
assertEquals(result.getCellTypeEnum(), CellType.NUMERIC); | |||
assertEquals(result.getCellType(), CellType.NUMERIC); | |||
assertEquals(expectedResult, result.getNumberValue(), 0); | |||
} | |||
} |
@@ -1,147 +0,0 @@ | |||
/* ==================================================================== | |||
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.ss.usermodel.charts; | |||
import static org.junit.Assert.assertEquals; | |||
import static org.junit.Assert.assertFalse; | |||
import static org.junit.Assert.assertNotNull; | |||
import static org.junit.Assert.assertNull; | |||
import static org.junit.Assert.assertTrue; | |||
import org.apache.poi.hssf.usermodel.HSSFWorkbook; | |||
import org.apache.poi.ss.usermodel.Sheet; | |||
import org.apache.poi.ss.usermodel.Workbook; | |||
import org.apache.poi.ss.util.CellRangeAddress; | |||
import org.apache.poi.ss.util.SheetBuilder; | |||
import org.junit.Test; | |||
/** | |||
* Tests for {@link org.apache.poi.ss.usermodel.charts.DataSources}. | |||
*/ | |||
@SuppressWarnings("deprecation") | |||
public class TestDataSources { | |||
private static final Object[][] numericCells = { | |||
{0.0, 1.0, 2.0, 3.0, 4.0}, | |||
{0.0, "=B1*2", "=C1*2", "=D1*2", "=E1*2"} | |||
}; | |||
private static final Object[][] stringCells = { | |||
{ 1, 2, 3, 4, 5}, | |||
{"A", "B", "C", "D", "E"} | |||
}; | |||
private static final Object[][] mixedCells = { | |||
{1.0, "2.0", 3.0, "4.0", 5.0, "6.0"} | |||
}; | |||
@Test | |||
public void testNumericArrayDataSource() { | |||
Double[] doubles = new Double[]{1.0, 2.0, 3.0, 4.0, 5.0}; | |||
ChartDataSource<Double> doubleDataSource = DataSources.fromArray(doubles); | |||
assertTrue(doubleDataSource.isNumeric()); | |||
assertFalse(doubleDataSource.isReference()); | |||
assertDataSourceIsEqualToArray(doubleDataSource, doubles); | |||
} | |||
@Test | |||
public void testStringArrayDataSource() { | |||
String[] strings = new String[]{"one", "two", "three", "four", "five"}; | |||
ChartDataSource<String> stringDataSource = DataSources.fromArray(strings); | |||
assertFalse(stringDataSource.isNumeric()); | |||
assertFalse(stringDataSource.isReference()); | |||
assertDataSourceIsEqualToArray(stringDataSource, strings); | |||
} | |||
@Test | |||
public void testNumericCellDataSource() { | |||
Workbook wb = new HSSFWorkbook(); | |||
Sheet sheet = new SheetBuilder(wb, numericCells).build(); | |||
CellRangeAddress numCellRange = CellRangeAddress.valueOf("A2:E2"); | |||
ChartDataSource<Number> numDataSource = DataSources.fromNumericCellRange(sheet, numCellRange); | |||
assertTrue(numDataSource.isReference()); | |||
assertTrue(numDataSource.isNumeric()); | |||
assertEquals(numericCells[0].length, numDataSource.getPointCount()); | |||
for (int i = 0; i < numericCells[0].length; ++i) { | |||
assertEquals(((Number) numericCells[0][i]).doubleValue() * 2, | |||
numDataSource.getPointAt(i).doubleValue(), 0.00001); | |||
} | |||
} | |||
@Test | |||
public void testStringCellDataSource() { | |||
Workbook wb = new HSSFWorkbook(); | |||
Sheet sheet = new SheetBuilder(wb, stringCells).build(); | |||
CellRangeAddress numCellRange = CellRangeAddress.valueOf("A2:E2"); | |||
ChartDataSource<String> numDataSource = DataSources.fromStringCellRange(sheet, numCellRange); | |||
assertTrue(numDataSource.isReference()); | |||
assertFalse(numDataSource.isNumeric()); | |||
assertEquals(numericCells[0].length, numDataSource.getPointCount()); | |||
for (int i = 0; i < stringCells[1].length; ++i) { | |||
assertEquals(stringCells[1][i], numDataSource.getPointAt(i)); | |||
} | |||
} | |||
@Test | |||
public void testMixedCellDataSource() { | |||
Workbook wb = new HSSFWorkbook(); | |||
Sheet sheet = new SheetBuilder(wb, mixedCells).build(); | |||
CellRangeAddress mixedCellRange = CellRangeAddress.valueOf("A1:F1"); | |||
ChartDataSource<String> strDataSource = DataSources.fromStringCellRange(sheet, mixedCellRange); | |||
ChartDataSource<Number> numDataSource = DataSources.fromNumericCellRange(sheet, mixedCellRange); | |||
for (int i = 0; i < mixedCells[0].length; ++i) { | |||
if (i % 2 == 0) { | |||
assertNull(strDataSource.getPointAt(i)); | |||
assertEquals(((Number) mixedCells[0][i]).doubleValue(), | |||
numDataSource.getPointAt(i).doubleValue(), 0.00001); | |||
} else { | |||
assertNull(numDataSource.getPointAt(i)); | |||
assertEquals(mixedCells[0][i], strDataSource.getPointAt(i)); | |||
} | |||
} | |||
} | |||
@Test | |||
public void testIOBExceptionOnInvalidIndex() { | |||
Workbook wb = new HSSFWorkbook(); | |||
Sheet sheet = new SheetBuilder(wb, numericCells).build(); | |||
CellRangeAddress rangeAddress = CellRangeAddress.valueOf("A2:E2"); | |||
ChartDataSource<Number> numDataSource = DataSources.fromNumericCellRange(sheet, rangeAddress); | |||
IndexOutOfBoundsException exception = null; | |||
try { | |||
numDataSource.getPointAt(-1); | |||
} catch (IndexOutOfBoundsException e) { | |||
exception = e; | |||
} | |||
assertNotNull(exception); | |||
exception = null; | |||
try { | |||
numDataSource.getPointAt(numDataSource.getPointCount()); | |||
} catch (IndexOutOfBoundsException e) { | |||
exception = e; | |||
} | |||
assertNotNull(exception); | |||
} | |||
private <T> void assertDataSourceIsEqualToArray(ChartDataSource<T> ds, T[] array) { | |||
assertEquals(ds.getPointCount(), array.length); | |||
for (int i = 0; i < array.length; ++i) { | |||
assertEquals(ds.getPointAt(i), array[i]); | |||
} | |||
} | |||
} |