diff options
author | Cédric Walter <cedricwalter@apache.org> | 2013-11-22 18:26:11 +0000 |
---|---|---|
committer | Cédric Walter <cedricwalter@apache.org> | 2013-11-22 18:26:11 +0000 |
commit | c36b01a601ccd54c94b854bb99d6b67a54d7cd4e (patch) | |
tree | e12dc674c8b931c96ff6aab7792d4c0c32012ee7 /src/java/org/apache/poi/ss/usermodel/charts | |
parent | 4a55b25fd8e1a1f554ae3b39d2be1531de909808 (diff) | |
download | poi-c36b01a601ccd54c94b854bb99d6b67a54d7cd4e.tar.gz poi-c36b01a601ccd54c94b854bb99d6b67a54d7cd4e.zip |
Bug 55768: added Line charts support and setting axis tick marks, title
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1544628 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/poi/ss/usermodel/charts')
8 files changed, 236 insertions, 4 deletions
diff --git a/src/java/org/apache/poi/ss/usermodel/charts/AxisTickMark.java b/src/java/org/apache/poi/ss/usermodel/charts/AxisTickMark.java new file mode 100644 index 0000000000..5c7d16a4e6 --- /dev/null +++ b/src/java/org/apache/poi/ss/usermodel/charts/AxisTickMark.java @@ -0,0 +1,30 @@ +/* ====================================================================
+ 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;
+
+/**
+ * Enumeration of possible axis tick marks.
+ *
+ * @author Martin Andersson
+ */
+public enum AxisTickMark {
+ NONE,
+ CROSS,
+ IN,
+ OUT
+}
diff --git a/src/java/org/apache/poi/ss/usermodel/charts/ChartAxis.java b/src/java/org/apache/poi/ss/usermodel/charts/ChartAxis.java index e4ccdb5db8..f3d9365894 100644 --- a/src/java/org/apache/poi/ss/usermodel/charts/ChartAxis.java +++ b/src/java/org/apache/poi/ss/usermodel/charts/ChartAxis.java @@ -26,7 +26,7 @@ import org.apache.poi.util.Beta; */ @Beta public interface ChartAxis { - + /** * @return axis id */ @@ -123,4 +123,34 @@ public interface ChartAxis { * @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); } diff --git a/src/java/org/apache/poi/ss/usermodel/charts/ChartDataFactory.java b/src/java/org/apache/poi/ss/usermodel/charts/ChartDataFactory.java index f75e66307d..675322da70 100644 --- a/src/java/org/apache/poi/ss/usermodel/charts/ChartDataFactory.java +++ b/src/java/org/apache/poi/ss/usermodel/charts/ChartDataFactory.java @@ -22,14 +22,19 @@ import org.apache.poi.util.Beta; /** * A factory for different charts data types. * - * @author Roman Kashitsyn + * @author Roman Kashitsyn, Martin Andersson */ @Beta public interface ChartDataFactory { - + /** * @return an appropriate ScatterChartData instance */ ScatterChartData createScatterChartData(); + /** + * @return a LineChartData instance + */ + LineChartData createLineChartData(); + } diff --git a/src/java/org/apache/poi/ss/usermodel/charts/ChartSerie.java b/src/java/org/apache/poi/ss/usermodel/charts/ChartSerie.java new file mode 100644 index 0000000000..47f9914b54 --- /dev/null +++ b/src/java/org/apache/poi/ss/usermodel/charts/ChartSerie.java @@ -0,0 +1,57 @@ +/* ====================================================================
+ 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;
+
+/**
+ * Basic settings for all chart series.
+ *
+ * @author Martin Andersson
+ */
+public interface ChartSerie {
+
+ /**
+ * 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();
+}
diff --git a/src/java/org/apache/poi/ss/usermodel/charts/LineChartData.java b/src/java/org/apache/poi/ss/usermodel/charts/LineChartData.java new file mode 100644 index 0000000000..dbc99700d3 --- /dev/null +++ b/src/java/org/apache/poi/ss/usermodel/charts/LineChartData.java @@ -0,0 +1,41 @@ +/* ====================================================================
+ 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.Beta;
+
+import java.util.List;
+
+/**
+ * @author Martin Andersson
+ */
+@Beta
+public interface LineChartData extends ChartData {
+
+ /**
+ * @param categories data source for categories.
+ * @param values data source for values.
+ * @return a new line chart serie.
+ */
+ LineChartSerie addSerie(ChartDataSource<?> categories, ChartDataSource<? extends Number> values);
+
+ /**
+ * @return list of all series.
+ */
+ List<? extends LineChartSerie> getSeries();
+}
diff --git a/src/java/org/apache/poi/ss/usermodel/charts/LineChartSerie.java b/src/java/org/apache/poi/ss/usermodel/charts/LineChartSerie.java new file mode 100644 index 0000000000..9dd9593925 --- /dev/null +++ b/src/java/org/apache/poi/ss/usermodel/charts/LineChartSerie.java @@ -0,0 +1,40 @@ +/* ====================================================================
+ 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.Beta;
+
+/**
+ * Represents a line chart serie.
+ *
+ * @author Martin Andersson
+ */
+@Beta
+public interface LineChartSerie extends ChartSerie {
+
+ /**
+ * @return data source used for category axis data.
+ */
+ ChartDataSource<?> getCategoryAxisData();
+
+ /**
+ * @return data source used for value axis.
+ */
+ ChartDataSource<? extends Number> getValues();
+
+}
diff --git a/src/java/org/apache/poi/ss/usermodel/charts/ScatterChartSerie.java b/src/java/org/apache/poi/ss/usermodel/charts/ScatterChartSerie.java index c968f79698..a5fa424993 100644 --- a/src/java/org/apache/poi/ss/usermodel/charts/ScatterChartSerie.java +++ b/src/java/org/apache/poi/ss/usermodel/charts/ScatterChartSerie.java @@ -23,9 +23,10 @@ import org.apache.poi.util.Beta; * Represents scatter charts serie. * * @author Roman Kashitsyn + * @author Martin Andersson */ @Beta -public interface ScatterChartSerie { +public interface ScatterChartSerie extends ChartSerie { /** * @return data source used for X axis values diff --git a/src/java/org/apache/poi/ss/usermodel/charts/TitleType.java b/src/java/org/apache/poi/ss/usermodel/charts/TitleType.java new file mode 100644 index 0000000000..6d93d61d36 --- /dev/null +++ b/src/java/org/apache/poi/ss/usermodel/charts/TitleType.java @@ -0,0 +1,28 @@ +/* ====================================================================
+ 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;
+
+/**
+ * Title types for charts.
+ *
+ * @author Martin Andersson
+ */
+public enum TitleType {
+ STRING,
+ CELL_REFERENCE
+}
|