use of org.devgateway.toolkit.web.excelcharts.util.CustomChartDataFactory in project ocvn by devgateway.
the class ExcelChartDefault method createWorkbook.
@Override
public Workbook createWorkbook() {
final ExcelChartSheet excelChartSheet = new ExcelChartSheetDefault(workbook, type.toString());
final Chart chart = excelChartSheet.createChartAndLegend();
addCategories(excelChartSheet);
addValues(excelChartSheet);
final CustomChartDataFactory customChartDataFactory = new CustomChartDataFactoryDefault();
final CustomChartData chartData = customChartDataFactory.createChartData(type, title);
final ChartDataSource<?> categoryDataSource = excelChartSheet.getCategoryChartDataSource();
final List<ChartDataSource<Number>> valuesDataSource = excelChartSheet.getValuesChartDataSource();
for (int i = 0; i < valuesDataSource.size(); i++) {
final ChartDataSource<Number> valueDataSource = valuesDataSource.get(i);
if (seriesTitle.isEmpty()) {
chartData.addSeries(categoryDataSource, valueDataSource);
} else {
chartData.addSeries(seriesTitle.get(i), categoryDataSource, valueDataSource);
}
}
// we don't have any axis for a pie chart
if (type.equals(ChartType.pie)) {
chart.plot(chartData);
} else {
// Use a category axis for the bottom axis.
final ChartAxis bottomAxis = chart.getChartAxisFactory().createCategoryAxis(AxisPosition.BOTTOM);
final ValueAxis leftAxis = chart.getChartAxisFactory().createValueAxis(AxisPosition.LEFT);
leftAxis.setCrosses(AxisCrosses.AUTO_ZERO);
chart.plot(chartData, bottomAxis, leftAxis);
}
return workbook;
}
use of org.devgateway.toolkit.web.excelcharts.util.CustomChartDataFactory in project oc-explorer by devgateway.
the class ExcelChartDefault method createWorkbook.
@Override
public Workbook createWorkbook() {
final ExcelChartSheet excelChartSheet = new ExcelChartSheetDefault(workbook, type.toString());
final Chart chart = excelChartSheet.createChartAndLegend();
addCategories(excelChartSheet);
addValues(excelChartSheet);
final CustomChartDataFactory customChartDataFactory = new CustomChartDataFactoryDefault();
final CustomChartData chartData = customChartDataFactory.createChartData(type, title);
final ChartDataSource<?> categoryDataSource = excelChartSheet.getCategoryChartDataSource();
final List<ChartDataSource<Number>> valuesDataSource = excelChartSheet.getValuesChartDataSource();
for (int i = 0; i < valuesDataSource.size(); i++) {
final ChartDataSource<Number> valueDataSource = valuesDataSource.get(i);
if (seriesTitle.isEmpty()) {
chartData.addSeries(categoryDataSource, valueDataSource);
} else {
chartData.addSeries(seriesTitle.get(i), categoryDataSource, valueDataSource);
}
}
// we don't have any axis for a pie chart
if (type.equals(ChartType.pie)) {
chart.plot(chartData);
} else {
// Use a category axis for the bottom axis.
final ChartAxis bottomAxis = chart.getChartAxisFactory().createCategoryAxis(AxisPosition.BOTTOM);
final ValueAxis leftAxis = chart.getChartAxisFactory().createValueAxis(AxisPosition.LEFT);
leftAxis.setCrosses(AxisCrosses.AUTO_ZERO);
chart.plot(chartData, bottomAxis, leftAxis);
}
return workbook;
}
Aggregations