diff --git a/src/java/org/apache/poi/ss/usermodel/charts/DataSources.java b/src/java/org/apache/poi/ss/usermodel/charts/DataSources.java index bca76a3762..5ebb8cf585 100644 --- a/src/java/org/apache/poi/ss/usermodel/charts/DataSources.java +++ b/src/java/org/apache/poi/ss/usermodel/charts/DataSources.java @@ -40,6 +40,7 @@ public class DataSources { public static ChartDataSource fromNumericCellRange(Sheet sheet, CellRangeAddress cellRangeAddress) { return new AbstractCellRangeDataSource(sheet, cellRangeAddress) { + @Override public Number getPointAt(int index) { CellValue cellValue = getCellValueAt(index); if (cellValue != null && cellValue.getCellType() == CellType.NUMERIC) { @@ -49,6 +50,7 @@ public class DataSources { } } + @Override public boolean isNumeric() { return true; } @@ -57,6 +59,7 @@ public class DataSources { public static ChartDataSource fromStringCellRange(Sheet sheet, CellRangeAddress cellRangeAddress) { return new AbstractCellRangeDataSource(sheet, cellRangeAddress) { + @Override public String getPointAt(int index) { CellValue cellValue = getCellValueAt(index); if (cellValue != null && cellValue.getCellType() == CellType.STRING) { @@ -66,6 +69,7 @@ public class DataSources { } } + @Override public boolean isNumeric() { return false; } @@ -80,23 +84,28 @@ public class DataSources { 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."); } @@ -116,14 +125,17 @@ public class DataSources { 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); }