Search in sources :

Example 6 with XSSFChart

use of org.apache.poi.xssf.usermodel.XSSFChart in project poi by apache.

the class XSSFScatterChartData method fillChart.

public void fillChart(Chart chart, ChartAxis... axis) {
    if (!(chart instanceof XSSFChart)) {
        throw new IllegalArgumentException("Chart must be instance of XSSFChart");
    }
    XSSFChart xssfChart = (XSSFChart) chart;
    CTPlotArea plotArea = xssfChart.getCTChart().getPlotArea();
    CTScatterChart scatterChart = plotArea.addNewScatterChart();
    addStyle(scatterChart);
    for (Series s : series) {
        s.addToChart(scatterChart);
    }
    for (ChartAxis ax : axis) {
        scatterChart.addNewAxId().setVal(ax.getId());
    }
}
Also used : XSSFChart(org.apache.poi.xssf.usermodel.XSSFChart) CTScatterChart(org.openxmlformats.schemas.drawingml.x2006.chart.CTScatterChart) ScatterChartSeries(org.apache.poi.ss.usermodel.charts.ScatterChartSeries) ChartAxis(org.apache.poi.ss.usermodel.charts.ChartAxis) CTPlotArea(org.openxmlformats.schemas.drawingml.x2006.chart.CTPlotArea)

Example 7 with XSSFChart

use of org.apache.poi.xssf.usermodel.XSSFChart in project ocvn by devgateway.

the class XSSFLineChartData method fillChart.

@Override
public void fillChart(final Chart chart, final ChartAxis... axis) {
    if (!(chart instanceof XSSFChart)) {
        throw new IllegalArgumentException("Chart must be instance of XSSFChart");
    }
    final XSSFChart xssfChart = (XSSFChart) chart;
    final CTPlotArea plotArea = xssfChart.getCTChart().getPlotArea();
    final CTLineChart lineChart = plotArea.addNewLineChart();
    lineChart.addNewVaryColors().setVal(false);
    for (CustomChartSeries s : series) {
        s.addToChart(lineChart);
    }
    for (ChartAxis ax : axis) {
        lineChart.addNewAxId().setVal(ax.getId());
    }
    xssfChart.setTitle(this.title);
    // add grid lines
    CTCatAx[] ctCatAx = plotArea.getCatAxArray();
    if (ctCatAx.length != 0) {
        ctCatAx[0].addNewMajorGridlines().addNewSpPr().addNewSolidFill();
    }
    CTValAx[] ctValAx = plotArea.getValAxArray();
    if (ctValAx.length != 0) {
        ctValAx[0].addNewMajorGridlines().addNewSpPr().addNewSolidFill();
    }
}
Also used : XSSFChart(org.apache.poi.xssf.usermodel.XSSFChart) CTLineChart(org.openxmlformats.schemas.drawingml.x2006.chart.CTLineChart) CustomChartSeries(org.devgateway.toolkit.web.excelcharts.CustomChartSeries) ChartAxis(org.apache.poi.ss.usermodel.charts.ChartAxis) CTValAx(org.openxmlformats.schemas.drawingml.x2006.chart.CTValAx) CTPlotArea(org.openxmlformats.schemas.drawingml.x2006.chart.CTPlotArea) CTCatAx(org.openxmlformats.schemas.drawingml.x2006.chart.CTCatAx)

Example 8 with XSSFChart

use of org.apache.poi.xssf.usermodel.XSSFChart in project ocvn by devgateway.

the class XSSFScatterChartData method fillChart.

@Override
public void fillChart(final Chart chart, final ChartAxis... axis) {
    if (!(chart instanceof XSSFChart)) {
        throw new IllegalArgumentException("Chart must be instance of XSSFChart");
    }
    final XSSFChart xssfChart = (XSSFChart) chart;
    final CTPlotArea plotArea = xssfChart.getCTChart().getPlotArea();
    final CTScatterChart scatterChart = plotArea.addNewScatterChart();
    addStyle(scatterChart);
    for (CustomChartSeries s : series) {
        s.addToChart(scatterChart);
    }
    for (ChartAxis ax : axis) {
        scatterChart.addNewAxId().setVal(ax.getId());
    }
    xssfChart.setTitle(this.title);
    // add grid lines
    CTCatAx[] ctCatAx = plotArea.getCatAxArray();
    if (ctCatAx.length != 0) {
        ctCatAx[0].addNewMajorGridlines().addNewSpPr().addNewSolidFill();
    }
    CTValAx[] ctValAx = plotArea.getValAxArray();
    if (ctValAx.length != 0) {
        ctValAx[0].addNewMajorGridlines().addNewSpPr().addNewSolidFill();
    }
}
Also used : XSSFChart(org.apache.poi.xssf.usermodel.XSSFChart) CTScatterChart(org.openxmlformats.schemas.drawingml.x2006.chart.CTScatterChart) CustomChartSeries(org.devgateway.toolkit.web.excelcharts.CustomChartSeries) ChartAxis(org.apache.poi.ss.usermodel.charts.ChartAxis) CTValAx(org.openxmlformats.schemas.drawingml.x2006.chart.CTValAx) CTPlotArea(org.openxmlformats.schemas.drawingml.x2006.chart.CTPlotArea) CTCatAx(org.openxmlformats.schemas.drawingml.x2006.chart.CTCatAx)

Example 9 with XSSFChart

use of org.apache.poi.xssf.usermodel.XSSFChart in project ocvn by devgateway.

the class XSSFStackedBarChartData method fillChart.

@Override
public void fillChart(final Chart chart, final ChartAxis... axis) {
    if (!(chart instanceof XSSFChart)) {
        throw new IllegalArgumentException("Chart must be instance of XSSFChart");
    }
    final XSSFChart xssfChart = (XSSFChart) chart;
    final CTPlotArea plotArea = xssfChart.getCTChart().getPlotArea();
    final CTBarChart barChart = plotArea.addNewBarChart();
    barChart.addNewVaryColors().setVal(false);
    // create a stacked bar
    barChart.addNewGrouping().setVal(barGrouping);
    barChart.addNewOverlap().setVal((byte) OVERLAPPERCENTAGE);
    // set bars orientation
    barChart.addNewBarDir().setVal(barDir);
    xssfChart.setTitle(this.title);
    CTValAx[] ctValAx = plotArea.getValAxArray();
    if (ctValAx.length != 0) {
        ctValAx[0].addNewMajorGridlines().addNewSpPr().addNewSolidFill();
        ctValAx[0].getCrossBetween().setVal(STCrossBetween.BETWEEN);
    }
    for (CustomChartSeries s : series) {
        s.addToChart(barChart);
    }
    for (ChartAxis ax : axis) {
        barChart.addNewAxId().setVal(ax.getId());
    }
}
Also used : XSSFChart(org.apache.poi.xssf.usermodel.XSSFChart) CTValAx(org.openxmlformats.schemas.drawingml.x2006.chart.CTValAx) CustomChartSeries(org.devgateway.toolkit.web.excelcharts.CustomChartSeries) ChartAxis(org.apache.poi.ss.usermodel.charts.ChartAxis) CTPlotArea(org.openxmlformats.schemas.drawingml.x2006.chart.CTPlotArea) CTBarChart(org.openxmlformats.schemas.drawingml.x2006.chart.CTBarChart)

Example 10 with XSSFChart

use of org.apache.poi.xssf.usermodel.XSSFChart in project ocvn by devgateway.

the class XSSFAreaChartData method fillChart.

@Override
public void fillChart(final Chart chart, final ChartAxis... axis) {
    if (!(chart instanceof XSSFChart)) {
        throw new IllegalArgumentException("Chart must be instance of XSSFChart");
    }
    final XSSFChart xssfChart = (XSSFChart) chart;
    final CTPlotArea plotArea = xssfChart.getCTChart().getPlotArea();
    final CTAreaChart areChart = plotArea.addNewAreaChart();
    areChart.addNewVaryColors().setVal(false);
    xssfChart.setTitle(this.title);
    CTValAx[] ctValAx = plotArea.getValAxArray();
    if (ctValAx.length != 0) {
        ctValAx[0].addNewMajorGridlines().addNewSpPr().addNewSolidFill();
        ctValAx[0].getCrossBetween().setVal(STCrossBetween.BETWEEN);
    }
    for (CustomChartSeries s : series) {
        s.addToChart(areChart);
    }
    for (ChartAxis ax : axis) {
        areChart.addNewAxId().setVal(ax.getId());
    }
}
Also used : XSSFChart(org.apache.poi.xssf.usermodel.XSSFChart) CTValAx(org.openxmlformats.schemas.drawingml.x2006.chart.CTValAx) CustomChartSeries(org.devgateway.toolkit.web.excelcharts.CustomChartSeries) ChartAxis(org.apache.poi.ss.usermodel.charts.ChartAxis) CTAreaChart(org.openxmlformats.schemas.drawingml.x2006.chart.CTAreaChart) CTPlotArea(org.openxmlformats.schemas.drawingml.x2006.chart.CTPlotArea)

Aggregations

XSSFChart (org.apache.poi.xssf.usermodel.XSSFChart)32 Workbook (org.apache.poi.ss.usermodel.Workbook)19 Test (org.junit.Test)19 XSSFWorkbook (org.apache.poi.xssf.usermodel.XSSFWorkbook)18 CTChart (org.openxmlformats.schemas.drawingml.x2006.chart.CTChart)18 Sheet (org.apache.poi.ss.usermodel.Sheet)17 XSSFDrawing (org.apache.poi.xssf.usermodel.XSSFDrawing)16 ByteArrayInputStream (java.io.ByteArrayInputStream)14 LangYearFilterPagingRequest (org.devgateway.ocds.web.rest.controller.request.LangYearFilterPagingRequest)13 ChartAxis (org.apache.poi.ss.usermodel.charts.ChartAxis)11 CTPlotArea (org.openxmlformats.schemas.drawingml.x2006.chart.CTPlotArea)11 CustomChartSeries (org.devgateway.toolkit.web.excelcharts.CustomChartSeries)7 CTValAx (org.openxmlformats.schemas.drawingml.x2006.chart.CTValAx)5 AddTrace (com.google.firebase.perf.metrics.AddTrace)3 SpreadsheetUtils.getCellRangeAddress (com.supercilex.robotscouter.data.client.spreadsheet.SpreadsheetUtils.getCellRangeAddress)3 SpreadsheetUtils.getMetricForChart (com.supercilex.robotscouter.data.client.spreadsheet.SpreadsheetUtils.getMetricForChart)3 PreferencesUtilsKt.setShouldShowExportHint (com.supercilex.robotscouter.util.PreferencesUtilsKt.setShouldShowExportHint)3 PreferencesUtilsKt.shouldShowExportHint (com.supercilex.robotscouter.util.PreferencesUtilsKt.shouldShowExportHint)3 Chart (org.apache.poi.ss.usermodel.Chart)3 RichTextString (org.apache.poi.ss.usermodel.RichTextString)3