From: Nick Burch Date: Tue, 4 Nov 2014 22:11:07 +0000 (+0000) Subject: Fix bug #57185 - Should be Series not Serie, latter is incorrect English / a Typo X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=4923afc9f84b8ce7123b190f95ce19dae554b9a6;p=poi.git Fix bug #57185 - Should be Series not Serie, latter is incorrect English / a Typo git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1636755 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/examples/src/org/apache/poi/xssf/usermodel/examples/LineChart.java b/src/examples/src/org/apache/poi/xssf/usermodel/examples/LineChart.java index 9fc24ac0d7..d8564c5231 100644 --- a/src/examples/src/org/apache/poi/xssf/usermodel/examples/LineChart.java +++ b/src/examples/src/org/apache/poi/xssf/usermodel/examples/LineChart.java @@ -16,17 +16,29 @@ ==================================================================== */ package org.apache.poi.xssf.usermodel.examples; -import org.apache.poi.ss.usermodel.*; -import org.apache.poi.ss.usermodel.charts.*; +import java.io.FileOutputStream; + +import org.apache.poi.ss.usermodel.Cell; +import org.apache.poi.ss.usermodel.Chart; +import org.apache.poi.ss.usermodel.ClientAnchor; +import org.apache.poi.ss.usermodel.Drawing; +import org.apache.poi.ss.usermodel.Row; +import org.apache.poi.ss.usermodel.Sheet; +import org.apache.poi.ss.usermodel.Workbook; +import org.apache.poi.ss.usermodel.charts.AxisCrosses; +import org.apache.poi.ss.usermodel.charts.AxisPosition; +import org.apache.poi.ss.usermodel.charts.ChartAxis; +import org.apache.poi.ss.usermodel.charts.ChartDataSource; +import org.apache.poi.ss.usermodel.charts.ChartLegend; +import org.apache.poi.ss.usermodel.charts.DataSources; +import org.apache.poi.ss.usermodel.charts.LegendPosition; +import org.apache.poi.ss.usermodel.charts.LineChartData; +import org.apache.poi.ss.usermodel.charts.ValueAxis; import org.apache.poi.ss.util.CellRangeAddress; import org.apache.poi.xssf.usermodel.XSSFWorkbook; -import java.io.FileOutputStream; - /** * Line chart example. - * - * @author Martin Andersson */ public class LineChart { @@ -66,8 +78,8 @@ public class LineChart { ChartDataSource ys2 = DataSources.fromNumericCellRange(sheet, new CellRangeAddress(2, 2, 0, NUM_OF_COLUMNS - 1)); - data.addSerie(xs, ys1); - data.addSerie(xs, ys2); + data.addSeries(xs, ys1); + data.addSeries(xs, ys2); chart.plot(data, bottomAxis, leftAxis); diff --git a/src/java/org/apache/poi/ss/usermodel/charts/ChartSerie.java b/src/java/org/apache/poi/ss/usermodel/charts/ChartSerie.java deleted file mode 100644 index 47f9914b54..0000000000 --- a/src/java/org/apache/poi/ss/usermodel/charts/ChartSerie.java +++ /dev/null @@ -1,57 +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; - -/** - * 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/ChartSeries.java b/src/java/org/apache/poi/ss/usermodel/charts/ChartSeries.java new file mode 100644 index 0000000000..05a39d45e5 --- /dev/null +++ b/src/java/org/apache/poi/ss/usermodel/charts/ChartSeries.java @@ -0,0 +1,55 @@ +/* ==================================================================== + 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. + */ +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(); +} diff --git a/src/java/org/apache/poi/ss/usermodel/charts/LineChartData.java b/src/java/org/apache/poi/ss/usermodel/charts/LineChartData.java index dbc99700d3..f3bf10f566 100644 --- a/src/java/org/apache/poi/ss/usermodel/charts/LineChartData.java +++ b/src/java/org/apache/poi/ss/usermodel/charts/LineChartData.java @@ -17,12 +17,12 @@ package org.apache.poi.ss.usermodel.charts; -import org.apache.poi.util.Beta; - import java.util.List; +import org.apache.poi.util.Beta; + /** - * @author Martin Andersson + * Data for a Line Chart */ @Beta public interface LineChartData extends ChartData { @@ -32,10 +32,10 @@ public interface LineChartData extends ChartData { * @param values data source for values. * @return a new line chart serie. */ - LineChartSerie addSerie(ChartDataSource categories, ChartDataSource values); + LineChartSeries addSeries(ChartDataSource categories, ChartDataSource values); /** * @return list of all series. */ - List getSeries(); + List 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 deleted file mode 100644 index 9dd9593925..0000000000 --- a/src/java/org/apache/poi/ss/usermodel/charts/LineChartSerie.java +++ /dev/null @@ -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.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 getValues(); - -} diff --git a/src/java/org/apache/poi/ss/usermodel/charts/LineChartSeries.java b/src/java/org/apache/poi/ss/usermodel/charts/LineChartSeries.java new file mode 100644 index 0000000000..d1c03a951a --- /dev/null +++ b/src/java/org/apache/poi/ss/usermodel/charts/LineChartSeries.java @@ -0,0 +1,38 @@ +/* ==================================================================== + 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 series. + */ +@Beta +public interface LineChartSeries extends ChartSeries { + + /** + * @return data source used for category axis data. + */ + ChartDataSource getCategoryAxisData(); + + /** + * @return data source used for value axis. + */ + ChartDataSource getValues(); + +} diff --git a/src/java/org/apache/poi/ss/usermodel/charts/ScatterChartData.java b/src/java/org/apache/poi/ss/usermodel/charts/ScatterChartData.java index 81917473b0..594b5bdfe3 100644 --- a/src/java/org/apache/poi/ss/usermodel/charts/ScatterChartData.java +++ b/src/java/org/apache/poi/ss/usermodel/charts/ScatterChartData.java @@ -20,18 +20,18 @@ package org.apache.poi.ss.usermodel.charts; import java.util.List; /** - * @author Roman Kashitsyn + * Data for a Scatter Chart */ 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 serie + * @return a new scatter charts series */ - ScatterChartSerie addSerie(ChartDataSource xs, ChartDataSource ys); + ScatterChartSeries addSerie(ChartDataSource xs, ChartDataSource ys); /** * @return list of all series */ - List getSeries(); + List getSeries(); } diff --git a/src/java/org/apache/poi/ss/usermodel/charts/ScatterChartSerie.java b/src/java/org/apache/poi/ss/usermodel/charts/ScatterChartSerie.java deleted file mode 100644 index a5fa424993..0000000000 --- a/src/java/org/apache/poi/ss/usermodel/charts/ScatterChartSerie.java +++ /dev/null @@ -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.Beta; - -/** - * Represents scatter charts serie. - * - * @author Roman Kashitsyn - * @author Martin Andersson - */ -@Beta -public interface ScatterChartSerie extends ChartSerie { - - /** - * @return data source used for X axis values - */ - ChartDataSource getXValues(); - - /** - * @return data source used for Y axis values - */ - ChartDataSource getYValues(); - -} diff --git a/src/java/org/apache/poi/ss/usermodel/charts/ScatterChartSeries.java b/src/java/org/apache/poi/ss/usermodel/charts/ScatterChartSeries.java new file mode 100644 index 0000000000..f200cb6ba2 --- /dev/null +++ b/src/java/org/apache/poi/ss/usermodel/charts/ScatterChartSeries.java @@ -0,0 +1,38 @@ +/* ==================================================================== + 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 scatter charts series. + */ +@Beta +public interface ScatterChartSeries extends ChartSeries { + + /** + * @return data source used for X axis values + */ + ChartDataSource getXValues(); + + /** + * @return data source used for Y axis values + */ + ChartDataSource getYValues(); + +} diff --git a/src/ooxml/java/org/apache/poi/xssf/usermodel/charts/AbstractXSSFChartSerie.java b/src/ooxml/java/org/apache/poi/xssf/usermodel/charts/AbstractXSSFChartSerie.java deleted file mode 100644 index eb2fb2f595..0000000000 --- a/src/ooxml/java/org/apache/poi/xssf/usermodel/charts/AbstractXSSFChartSerie.java +++ /dev/null @@ -1,79 +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.xssf.usermodel.charts; - -import org.apache.poi.ss.usermodel.charts.ChartSerie; -import org.apache.poi.ss.usermodel.charts.TitleType; -import org.apache.poi.ss.util.CellReference; -import org.openxmlformats.schemas.drawingml.x2006.chart.CTSerTx; - -/** - * @author Martin Andersson - */ -public abstract class AbstractXSSFChartSerie implements ChartSerie { - - private String titleValue; - private CellReference titleRef; - private TitleType titleType; - - public void setTitle(CellReference titleReference) { - titleType = TitleType.CELL_REFERENCE; - titleRef = titleReference; - } - - public void setTitle(String title) { - titleType = TitleType.STRING; - titleValue = title; - } - - public CellReference getTitleCellReference() { - if (TitleType.CELL_REFERENCE.equals(titleType)) { - return titleRef; - } - throw new IllegalStateException("Title type is not CellReference."); - } - - public String getTitleString() { - if (TitleType.STRING.equals(titleType)) { - return titleValue; - } - throw new IllegalStateException("Title type is not String."); - } - - public TitleType getTitleType() { - return titleType; - } - - protected boolean isTitleSet() { - return titleType != null; - } - - protected CTSerTx getCTSerTx() { - CTSerTx tx = CTSerTx.Factory.newInstance(); - switch (titleType) { - case CELL_REFERENCE: - tx.addNewStrRef().setF(titleRef.formatAsString()); - return tx; - case STRING: - tx.setV(titleValue); - return tx; - default: - throw new IllegalStateException("Unkown title type: " + titleType); - } - } -} diff --git a/src/ooxml/java/org/apache/poi/xssf/usermodel/charts/AbstractXSSFChartSeries.java b/src/ooxml/java/org/apache/poi/xssf/usermodel/charts/AbstractXSSFChartSeries.java new file mode 100644 index 0000000000..09393e51a5 --- /dev/null +++ b/src/ooxml/java/org/apache/poi/xssf/usermodel/charts/AbstractXSSFChartSeries.java @@ -0,0 +1,79 @@ +/* ==================================================================== + 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.xssf.usermodel.charts; + +import org.apache.poi.ss.usermodel.charts.ChartSeries; +import org.apache.poi.ss.usermodel.charts.TitleType; +import org.apache.poi.ss.util.CellReference; +import org.openxmlformats.schemas.drawingml.x2006.chart.CTSerTx; + +/** + * Base of all XSSF Chart Series + */ +public abstract class AbstractXSSFChartSeries implements ChartSeries { + + private String titleValue; + private CellReference titleRef; + private TitleType titleType; + + public void setTitle(CellReference titleReference) { + titleType = TitleType.CELL_REFERENCE; + titleRef = titleReference; + } + + public void setTitle(String title) { + titleType = TitleType.STRING; + titleValue = title; + } + + public CellReference getTitleCellReference() { + if (TitleType.CELL_REFERENCE.equals(titleType)) { + return titleRef; + } + throw new IllegalStateException("Title type is not CellReference."); + } + + public String getTitleString() { + if (TitleType.STRING.equals(titleType)) { + return titleValue; + } + throw new IllegalStateException("Title type is not String."); + } + + public TitleType getTitleType() { + return titleType; + } + + protected boolean isTitleSet() { + return titleType != null; + } + + protected CTSerTx getCTSerTx() { + CTSerTx tx = CTSerTx.Factory.newInstance(); + switch (titleType) { + case CELL_REFERENCE: + tx.addNewStrRef().setF(titleRef.formatAsString()); + return tx; + case STRING: + tx.setV(titleValue); + return tx; + default: + throw new IllegalStateException("Unkown title type: " + titleType); + } + } +} diff --git a/src/ooxml/java/org/apache/poi/xssf/usermodel/charts/XSSFLineChartData.java b/src/ooxml/java/org/apache/poi/xssf/usermodel/charts/XSSFLineChartData.java index 7da2b1e383..54bba03bb2 100644 --- a/src/ooxml/java/org/apache/poi/xssf/usermodel/charts/XSSFLineChartData.java +++ b/src/ooxml/java/org/apache/poi/xssf/usermodel/charts/XSSFLineChartData.java @@ -17,20 +17,25 @@ package org.apache.poi.xssf.usermodel.charts; +import java.util.ArrayList; +import java.util.List; + import org.apache.poi.ss.usermodel.Chart; import org.apache.poi.ss.usermodel.charts.ChartAxis; import org.apache.poi.ss.usermodel.charts.ChartDataSource; import org.apache.poi.ss.usermodel.charts.LineChartData; -import org.apache.poi.ss.usermodel.charts.LineChartSerie; +import org.apache.poi.ss.usermodel.charts.LineChartSeries; import org.apache.poi.util.Beta; import org.apache.poi.xssf.usermodel.XSSFChart; -import org.openxmlformats.schemas.drawingml.x2006.chart.*; - -import java.util.ArrayList; -import java.util.List; +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.CTNumDataSource; +import org.openxmlformats.schemas.drawingml.x2006.chart.CTPlotArea; +import org.openxmlformats.schemas.drawingml.x2006.chart.STMarkerStyle; /** - * @author Martin Andersson + * Holds data for a XSSF Line Chart */ @Beta public class XSSFLineChartData implements LineChartData { @@ -38,19 +43,19 @@ public class XSSFLineChartData implements LineChartData { /** * List of all data series. */ - private List series; + private List series; public XSSFLineChartData() { - series = new ArrayList(); + series = new ArrayList(); } - static class Serie extends AbstractXSSFChartSerie implements LineChartSerie { + static class Series extends AbstractXSSFChartSeries implements LineChartSeries { private int id; private int order; private ChartDataSource categories; private ChartDataSource values; - protected Serie(int id, int order, + protected Series(int id, int order, ChartDataSource categories, ChartDataSource values) { this.id = id; @@ -86,17 +91,17 @@ public class XSSFLineChartData implements LineChartData { } } - public LineChartSerie addSerie(ChartDataSource categoryAxisData, ChartDataSource values) { + public LineChartSeries addSeries(ChartDataSource categoryAxisData, ChartDataSource values) { if (!values.isNumeric()) { throw new IllegalArgumentException("Value data source must be numeric."); } int numOfSeries = series.size(); - Serie newSerie = new Serie(numOfSeries, numOfSeries, categoryAxisData, values); - series.add(newSerie); - return newSerie; + Series newSeries = new Series(numOfSeries, numOfSeries, categoryAxisData, values); + series.add(newSeries); + return newSeries; } - public List getSeries() { + public List getSeries() { return series; } @@ -110,7 +115,7 @@ public class XSSFLineChartData implements LineChartData { CTLineChart lineChart = plotArea.addNewLineChart(); lineChart.addNewVaryColors().setVal(false); - for (Serie s : series) { + for (Series s : series) { s.addToChart(lineChart); } diff --git a/src/ooxml/java/org/apache/poi/xssf/usermodel/charts/XSSFScatterChartData.java b/src/ooxml/java/org/apache/poi/xssf/usermodel/charts/XSSFScatterChartData.java index 088e6fc2a7..f31b355031 100644 --- a/src/ooxml/java/org/apache/poi/xssf/usermodel/charts/XSSFScatterChartData.java +++ b/src/ooxml/java/org/apache/poi/xssf/usermodel/charts/XSSFScatterChartData.java @@ -17,23 +17,27 @@ package org.apache.poi.xssf.usermodel.charts; +import java.util.ArrayList; +import java.util.List; + import org.apache.poi.ss.usermodel.Chart; import org.apache.poi.ss.usermodel.charts.ChartAxis; import org.apache.poi.ss.usermodel.charts.ChartDataSource; import org.apache.poi.ss.usermodel.charts.ScatterChartData; -import org.apache.poi.ss.usermodel.charts.ScatterChartSerie; +import org.apache.poi.ss.usermodel.charts.ScatterChartSeries; import org.apache.poi.util.Beta; import org.apache.poi.xssf.usermodel.XSSFChart; -import org.openxmlformats.schemas.drawingml.x2006.chart.*; - -import java.util.ArrayList; -import java.util.List; +import org.openxmlformats.schemas.drawingml.x2006.chart.CTAxDataSource; +import org.openxmlformats.schemas.drawingml.x2006.chart.CTNumDataSource; +import org.openxmlformats.schemas.drawingml.x2006.chart.CTPlotArea; +import org.openxmlformats.schemas.drawingml.x2006.chart.CTScatterChart; +import org.openxmlformats.schemas.drawingml.x2006.chart.CTScatterSer; +import org.openxmlformats.schemas.drawingml.x2006.chart.CTScatterStyle; +import org.openxmlformats.schemas.drawingml.x2006.chart.STScatterStyle; /** * Represents DrawingML scatter charts. - * - * @author Roman Kashitsyn */ @Beta public class XSSFScatterChartData implements ScatterChartData { @@ -41,22 +45,22 @@ public class XSSFScatterChartData implements ScatterChartData { /** * List of all data series. */ - private List series; + private List series; public XSSFScatterChartData() { - series = new ArrayList(); + series = new ArrayList(); } /** * Package private ScatterChartSerie implementation. */ - static class Serie extends AbstractXSSFChartSerie implements ScatterChartSerie { + static class Series extends AbstractXSSFChartSeries implements ScatterChartSeries { private int id; private int order; private ChartDataSource xs; private ChartDataSource ys; - protected Serie(int id, int order, + protected Series(int id, int order, ChartDataSource xs, ChartDataSource ys) { super(); @@ -99,13 +103,13 @@ public class XSSFScatterChartData implements ScatterChartData { } } - public ScatterChartSerie addSerie(ChartDataSource xs, + public ScatterChartSeries addSerie(ChartDataSource xs, ChartDataSource ys) { if (!ys.isNumeric()) { throw new IllegalArgumentException("Y axis data source must be numeric."); } int numOfSeries = series.size(); - Serie newSerie = new Serie(numOfSeries, numOfSeries, xs, ys); + Series newSerie = new Series(numOfSeries, numOfSeries, xs, ys); series.add(newSerie); return newSerie; } @@ -120,7 +124,7 @@ public class XSSFScatterChartData implements ScatterChartData { CTScatterChart scatterChart = plotArea.addNewScatterChart(); addStyle(scatterChart); - for (Serie s : series) { + for (Series s : series) { s.addToChart(scatterChart); } @@ -129,7 +133,7 @@ public class XSSFScatterChartData implements ScatterChartData { } } - public List getSeries() { + public List getSeries() { return series; } diff --git a/src/ooxml/testcases/org/apache/poi/xssf/usermodel/charts/TestXSSFLineChartData.java b/src/ooxml/testcases/org/apache/poi/xssf/usermodel/charts/TestXSSFLineChartData.java index c4c04b8d94..cf7fd78ed3 100644 --- a/src/ooxml/testcases/org/apache/poi/xssf/usermodel/charts/TestXSSFLineChartData.java +++ b/src/ooxml/testcases/org/apache/poi/xssf/usermodel/charts/TestXSSFLineChartData.java @@ -28,13 +28,13 @@ import org.apache.poi.ss.usermodel.charts.ChartAxis; import org.apache.poi.ss.usermodel.charts.ChartDataSource; import org.apache.poi.ss.usermodel.charts.DataSources; import org.apache.poi.ss.usermodel.charts.LineChartData; -import org.apache.poi.ss.usermodel.charts.LineChartSerie; +import org.apache.poi.ss.usermodel.charts.LineChartSeries; import org.apache.poi.ss.util.CellRangeAddress; import org.apache.poi.ss.util.SheetBuilder; import org.apache.poi.xssf.usermodel.XSSFWorkbook; /** - * @author Martin Andersson + * Tests for XSSF Line Charts */ public class TestXSSFLineChartData extends TestCase { @@ -58,7 +58,7 @@ public class TestXSSFLineChartData extends TestCase { ChartDataSource xs = DataSources.fromStringCellRange(sheet, CellRangeAddress.valueOf("A1:J1")); ChartDataSource ys = DataSources.fromNumericCellRange(sheet, CellRangeAddress.valueOf("A2:J2")); - LineChartSerie series = lineChartData.addSerie(xs, ys); + LineChartSeries series = lineChartData.addSeries(xs, ys); assertNotNull(series); assertEquals(1, lineChartData.getSeries().size()); diff --git a/src/ooxml/testcases/org/apache/poi/xssf/usermodel/charts/TestXSSFScatterChartData.java b/src/ooxml/testcases/org/apache/poi/xssf/usermodel/charts/TestXSSFScatterChartData.java index 2780a51767..e041e891c6 100644 --- a/src/ooxml/testcases/org/apache/poi/xssf/usermodel/charts/TestXSSFScatterChartData.java +++ b/src/ooxml/testcases/org/apache/poi/xssf/usermodel/charts/TestXSSFScatterChartData.java @@ -19,16 +19,23 @@ package org.apache.poi.xssf.usermodel.charts; import junit.framework.TestCase; -import org.apache.poi.ss.usermodel.*; +import org.apache.poi.ss.usermodel.Chart; +import org.apache.poi.ss.usermodel.ClientAnchor; +import org.apache.poi.ss.usermodel.Drawing; +import org.apache.poi.ss.usermodel.Sheet; +import org.apache.poi.ss.usermodel.Workbook; +import org.apache.poi.ss.usermodel.charts.AxisPosition; +import org.apache.poi.ss.usermodel.charts.ChartAxis; +import org.apache.poi.ss.usermodel.charts.ChartDataSource; +import org.apache.poi.ss.usermodel.charts.DataSources; +import org.apache.poi.ss.usermodel.charts.ScatterChartData; +import org.apache.poi.ss.usermodel.charts.ScatterChartSeries; import org.apache.poi.ss.util.CellRangeAddress; import org.apache.poi.ss.util.SheetBuilder; -import org.apache.poi.ss.usermodel.charts.*; import org.apache.poi.xssf.usermodel.XSSFWorkbook; /** * Tests for XSSFScatterChartData. - * - * @author Roman Kashitsyn */ public final class TestXSSFScatterChartData extends TestCase { @@ -52,7 +59,7 @@ public final class TestXSSFScatterChartData extends TestCase { ChartDataSource xs = DataSources.fromStringCellRange(sheet, CellRangeAddress.valueOf("A1:J1")); ChartDataSource ys = DataSources.fromNumericCellRange(sheet, CellRangeAddress.valueOf("A2:J2")); - ScatterChartSerie series = scatterChartData.addSerie(xs, ys); + ScatterChartSeries series = scatterChartData.addSerie(xs, ys); assertNotNull(series); assertEquals(1, scatterChartData.getSeries().size());