Hello.
There is exists some method for chart for applying chart data and category data in one step. Now i have this ability in Excel and trying to use method "series.add", but results are different.
@Test
public void calculationChainTest() {
try {
Workbook wb = new Workbook("D:\\chart.xlsx");
Chart chart = wb.getWorksheets().get(0).getCharts().get(0);
SeriesCollection series = chart.getNSeries();
series.add("Chart!B4:E8", true);
wb.save("D:\\out.xlsx");
} catch (Exception e) {
e.printStackTrace();
assertNull(e);
}
}
But excel (chart data source string) shows, that results are identical. If i will open out.xlsx and twice toggle button for source i will receive right result.
Also i have reveived right result by using following code
@Test
public void calculationChainTest() {
try {
Workbook wb = new Workbook("D:\\chart.xlsx");
Chart chart = wb.getWorksheets().get(0).getCharts().get(0);
SeriesCollection series = chart.getNSeries();
series.add("Chart!C4:E8", true);
series.setCategoryData("Chart!B4:B8");
wb.save("D:\\out.xlsx");
} catch (Exception e) {
e.printStackTrace();
assertNull(e);
}
}
But i want to use "one-line-code"