ExcelChartSheetDefault implements ExcelChartSheet { @Override public List<ChartDataSource<Number>> getValuesChartDataSource() { if (excelSheet.getPhysicalNumberOfRows() <= 1) { throw new IllegalStateException("It seems that we don't have any values in the excel file"); } final List<ChartDataSource<Number>> valuesDataSource = new ArrayList<>(); for (int i = 1; i < excelSheet.getPhysicalNumberOfRows(); i++) { valuesDataSource.add(getChartDataSource(i)); } return valuesDataSource; } ExcelChartSheetDefault(final Workbook workbook, final String excelSheetName); @Override void writeCell(final Object value, final Row row, final int column); @Override Row createRow(final int rowNumber); @Override Row createRow(); @Override void setColumnWidth(final int collNumber, final int size); @Override Chart createChartAndLegend(); @Override ChartDataSource<?> getCategoryChartDataSource(); @Override List<ChartDataSource<Number>> getValuesChartDataSource();  }
@Test public void getValuesChartDataSource() throws Exception { final ExcelChartSheet excelChartSheet = new ExcelChartSheetDefault(workbook, ChartType.stackedbar.toString()); addCategories(excelChartSheet); addValues(excelChartSheet); List<ChartDataSource<Number>> valuesChartDataSource = excelChartSheet.getValuesChartDataSource(); Assert.assertEquals("numbers of values data source", 2, valuesChartDataSource.size()); Assert.assertEquals("check count of values", 5, valuesChartDataSource.get(0).getPointCount()); Assert.assertEquals("check count of values", 5, valuesChartDataSource.get(1).getPointCount()); Assert.assertEquals("check first value", 5.0, valuesChartDataSource.get(0).getPointAt(0)); Assert.assertEquals("check last value", 6.0, valuesChartDataSource.get(0).getPointAt(4)); Assert.assertEquals("check first value", 20.0, valuesChartDataSource.get(1).getPointAt(0)); Assert.assertEquals("check last value", 14.0, valuesChartDataSource.get(1).getPointAt(4)); }