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
This commit is contained in:
Nick Burch 2014-11-04 22:11:07 +00:00
parent 3b4a96bbc2
commit 4923afc9f8
11 changed files with 92 additions and 71 deletions

View File

@ -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<Number> 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);

View File

@ -21,10 +21,8 @@ import org.apache.poi.ss.util.CellReference;
/**
* Basic settings for all chart series.
*
* @author Martin Andersson
*/
public interface ChartSerie {
public interface ChartSeries {
/**
* Sets the title of the series as a string literal.

View File

@ -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<? extends Number> values);
LineChartSeries addSeries(ChartDataSource<?> categories, ChartDataSource<? extends Number> values);
/**
* @return list of all series.
*/
List<? extends LineChartSerie> getSeries();
List<? extends LineChartSeries> getSeries();
}

View File

@ -20,12 +20,10 @@ package org.apache.poi.ss.usermodel.charts;
import org.apache.poi.util.Beta;
/**
* Represents a line chart serie.
*
* @author Martin Andersson
* Represents a line chart series.
*/
@Beta
public interface LineChartSerie extends ChartSerie {
public interface LineChartSeries extends ChartSeries {
/**
* @return data source used for category axis data.

View File

@ -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<? extends Number> ys);
ScatterChartSeries addSerie(ChartDataSource<?> xs, ChartDataSource<? extends Number> ys);
/**
* @return list of all series
*/
List<? extends ScatterChartSerie> getSeries();
List<? extends ScatterChartSeries> getSeries();
}

View File

@ -20,13 +20,10 @@ package org.apache.poi.ss.usermodel.charts;
import org.apache.poi.util.Beta;
/**
* Represents scatter charts serie.
*
* @author Roman Kashitsyn
* @author Martin Andersson
* Represents scatter charts series.
*/
@Beta
public interface ScatterChartSerie extends ChartSerie {
public interface ScatterChartSeries extends ChartSeries {
/**
* @return data source used for X axis values

View File

@ -17,15 +17,15 @@
package org.apache.poi.xssf.usermodel.charts;
import org.apache.poi.ss.usermodel.charts.ChartSerie;
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;
/**
* @author Martin Andersson
* Base of all XSSF Chart Series
*/
public abstract class AbstractXSSFChartSerie implements ChartSerie {
public abstract class AbstractXSSFChartSeries implements ChartSeries {
private String titleValue;
private CellReference titleRef;

View File

@ -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<Serie> series;
private List<Series> series;
public XSSFLineChartData() {
series = new ArrayList<Serie>();
series = new ArrayList<Series>();
}
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<? extends Number> values;
protected Serie(int id, int order,
protected Series(int id, int order,
ChartDataSource<?> categories,
ChartDataSource<? extends Number> values) {
this.id = id;
@ -86,17 +91,17 @@ public class XSSFLineChartData implements LineChartData {
}
}
public LineChartSerie addSerie(ChartDataSource<?> categoryAxisData, ChartDataSource<? extends Number> values) {
public LineChartSeries addSeries(ChartDataSource<?> categoryAxisData, ChartDataSource<? extends Number> 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<? extends LineChartSerie> getSeries() {
public List<? extends LineChartSeries> 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);
}

View File

@ -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<Serie> series;
private List<Series> series;
public XSSFScatterChartData() {
series = new ArrayList<Serie>();
series = new ArrayList<Series>();
}
/**
* 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<? extends Number> ys;
protected Serie(int id, int order,
protected Series(int id, int order,
ChartDataSource<?> xs,
ChartDataSource<? extends Number> ys) {
super();
@ -99,13 +103,13 @@ public class XSSFScatterChartData implements ScatterChartData {
}
}
public ScatterChartSerie addSerie(ChartDataSource<?> xs,
public ScatterChartSeries addSerie(ChartDataSource<?> xs,
ChartDataSource<? extends Number> 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<? extends Serie> getSeries() {
public List<? extends Series> getSeries() {
return series;
}

View File

@ -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<String> xs = DataSources.fromStringCellRange(sheet, CellRangeAddress.valueOf("A1:J1"));
ChartDataSource<Number> 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());

View File

@ -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<String> xs = DataSources.fromStringCellRange(sheet, CellRangeAddress.valueOf("A1:J1"));
ChartDataSource<Number> 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());