Search in sources :

Example 41 with CTChart

use of org.openxmlformats.schemas.drawingml.x2006.chart.CTChart in project oc-explorer by devgateway.

the class XSSFScatterChartData method createNewSerie.

@Override
protected CustomChartSeries createNewSerie(final int id, final int order, final ChartDataSource<?> categories, final ChartDataSource<? extends Number> values) {
    return new AbstractSeries(id, order, categories, values) {

        @Override
        public void addToChart(final XmlObject ctChart) {
            final CTScatterChart ctScatterChart = (CTScatterChart) ctChart;
            final CTScatterSer scatterSer = ctScatterChart.addNewSer();
            scatterSer.addNewIdx().setVal(this.id);
            scatterSer.addNewOrder().setVal(this.order);
            final CTAxDataSource catDS = scatterSer.addNewXVal();
            XSSFChartUtil.buildAxDataSource(catDS, this.categories);
            final CTNumDataSource valueDS = scatterSer.addNewYVal();
            XSSFChartUtil.buildNumDataSource(valueDS, this.values);
            if (isTitleSet()) {
                scatterSer.setTx(getCTSerTx());
            }
        }
    };
}
Also used : CTScatterChart(org.openxmlformats.schemas.drawingml.x2006.chart.CTScatterChart) CTNumDataSource(org.openxmlformats.schemas.drawingml.x2006.chart.CTNumDataSource) CTScatterSer(org.openxmlformats.schemas.drawingml.x2006.chart.CTScatterSer) XmlObject(org.apache.xmlbeans.XmlObject) CTAxDataSource(org.openxmlformats.schemas.drawingml.x2006.chart.CTAxDataSource)

Example 42 with CTChart

use of org.openxmlformats.schemas.drawingml.x2006.chart.CTChart in project oc-explorer by devgateway.

the class XSSFBarChartData method createNewSerie.

@Override
protected CustomChartSeries createNewSerie(final int id, final int order, final ChartDataSource<?> categories, final ChartDataSource<? extends Number> values) {
    return new AbstractSeries(id, order, categories, values) {

        @Override
        public void addToChart(final XmlObject ctChart) {
            final CTBarChart ctBarChart = (CTBarChart) ctChart;
            final CTBarSer ctBarSer = ctBarChart.addNewSer();
            ctBarSer.addNewIdx().setVal(this.id);
            ctBarSer.addNewOrder().setVal(this.order);
            final CTAxDataSource catDS = ctBarSer.addNewCat();
            XSSFChartUtil.buildAxDataSource(catDS, this.categories);
            final CTNumDataSource valueDS = ctBarSer.addNewVal();
            XSSFChartUtil.buildNumDataSource(valueDS, this.values);
            if (isTitleSet()) {
                ctBarSer.setTx(getCTSerTx());
            }
        }
    };
}
Also used : CTNumDataSource(org.openxmlformats.schemas.drawingml.x2006.chart.CTNumDataSource) CTBarSer(org.openxmlformats.schemas.drawingml.x2006.chart.CTBarSer) XmlObject(org.apache.xmlbeans.XmlObject) CTBarChart(org.openxmlformats.schemas.drawingml.x2006.chart.CTBarChart) CTAxDataSource(org.openxmlformats.schemas.drawingml.x2006.chart.CTAxDataSource)

Aggregations

CTChart (org.openxmlformats.schemas.drawingml.x2006.chart.CTChart)30 XSSFChart (org.apache.poi.xssf.usermodel.XSSFChart)28 Test (org.junit.Test)28 Sheet (org.apache.poi.ss.usermodel.Sheet)27 Workbook (org.apache.poi.ss.usermodel.Workbook)27 XSSFDrawing (org.apache.poi.xssf.usermodel.XSSFDrawing)27 XSSFWorkbook (org.apache.poi.xssf.usermodel.XSSFWorkbook)27 ByteArrayInputStream (java.io.ByteArrayInputStream)25 LangYearFilterPagingRequest (org.devgateway.ocds.web.rest.controller.request.LangYearFilterPagingRequest)23 CTAxDataSource (org.openxmlformats.schemas.drawingml.x2006.chart.CTAxDataSource)16 CTNumDataSource (org.openxmlformats.schemas.drawingml.x2006.chart.CTNumDataSource)16 XmlObject (org.apache.xmlbeans.XmlObject)12 CTLineChart (org.openxmlformats.schemas.drawingml.x2006.chart.CTLineChart)4 CTLineSer (org.openxmlformats.schemas.drawingml.x2006.chart.CTLineSer)4 CTPieChart (org.openxmlformats.schemas.drawingml.x2006.chart.CTPieChart)4 CTPieSer (org.openxmlformats.schemas.drawingml.x2006.chart.CTPieSer)4 CellRangeAddress (org.apache.poi.ss.util.CellRangeAddress)3 CTPlotArea (org.openxmlformats.schemas.drawingml.x2006.chart.CTPlotArea)3 OutputStream (java.io.OutputStream)2 POIXMLDocumentPart (org.apache.poi.POIXMLDocumentPart)2