Search in sources :

Example 1 with ExcelChartDefault

use of org.devgateway.toolkit.web.excelcharts.ExcelChartDefault in project oc-explorer by devgateway.

the class ExcelChartGenerator method getExcelChart.

/**
 * Generate an Excel Chart based on (categories, values)
 */
@Cacheable
public byte[] getExcelChart(final ChartType type, final String title, final List<String> seriesTitle, final List<?> categories, final List<List<? extends Number>> values) throws IOException {
    final ExcelChart excelChart = new ExcelChartDefault(title, type, categories, values);
    excelChart.configureSeriesTitle(seriesTitle);
    final Workbook workbook = excelChart.createWorkbook();
    final ByteArrayOutputStream baos = new ByteArrayOutputStream();
    workbook.write(baos);
    return baos.toByteArray();
}
Also used : ExcelChart(org.devgateway.toolkit.web.excelcharts.ExcelChart) ExcelChartDefault(org.devgateway.toolkit.web.excelcharts.ExcelChartDefault) ByteArrayOutputStream(java.io.ByteArrayOutputStream) Workbook(org.apache.poi.ss.usermodel.Workbook) Cacheable(org.springframework.cache.annotation.Cacheable)

Example 2 with ExcelChartDefault

use of org.devgateway.toolkit.web.excelcharts.ExcelChartDefault in project ocvn by devgateway.

the class ExcelChartGenerator method getExcelChart.

/**
 * Generate an Excel Chart based on (categories, values)
 */
@Cacheable
public byte[] getExcelChart(final ChartType type, final String title, final List<String> seriesTitle, final List<?> categories, final List<List<? extends Number>> values) throws IOException {
    final ExcelChart excelChart = new ExcelChartDefault(title, type, categories, values);
    excelChart.configureSeriesTitle(seriesTitle);
    final Workbook workbook = excelChart.createWorkbook();
    final ByteArrayOutputStream baos = new ByteArrayOutputStream();
    workbook.write(baos);
    return baos.toByteArray();
}
Also used : ExcelChart(org.devgateway.toolkit.web.excelcharts.ExcelChart) ExcelChartDefault(org.devgateway.toolkit.web.excelcharts.ExcelChartDefault) ByteArrayOutputStream(java.io.ByteArrayOutputStream) Workbook(org.apache.poi.ss.usermodel.Workbook) Cacheable(org.springframework.cache.annotation.Cacheable)

Aggregations

ByteArrayOutputStream (java.io.ByteArrayOutputStream)2 Workbook (org.apache.poi.ss.usermodel.Workbook)2 ExcelChart (org.devgateway.toolkit.web.excelcharts.ExcelChart)2 ExcelChartDefault (org.devgateway.toolkit.web.excelcharts.ExcelChartDefault)2 Cacheable (org.springframework.cache.annotation.Cacheable)2