Search in sources :

Example 1 with CTCatAx

use of org.openxmlformats.schemas.drawingml.x2006.chart.CTCatAx 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 2 with CTCatAx

use of org.openxmlformats.schemas.drawingml.x2006.chart.CTCatAx 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 3 with CTCatAx

use of org.openxmlformats.schemas.drawingml.x2006.chart.CTCatAx in project oc-explorer 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.setTitleText(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 4 with CTCatAx

use of org.openxmlformats.schemas.drawingml.x2006.chart.CTCatAx in project oc-explorer 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.setTitleText(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)

Aggregations

ChartAxis (org.apache.poi.ss.usermodel.charts.ChartAxis)4 XSSFChart (org.apache.poi.xssf.usermodel.XSSFChart)4 CustomChartSeries (org.devgateway.toolkit.web.excelcharts.CustomChartSeries)4 CTCatAx (org.openxmlformats.schemas.drawingml.x2006.chart.CTCatAx)4 CTPlotArea (org.openxmlformats.schemas.drawingml.x2006.chart.CTPlotArea)4 CTValAx (org.openxmlformats.schemas.drawingml.x2006.chart.CTValAx)4 CTLineChart (org.openxmlformats.schemas.drawingml.x2006.chart.CTLineChart)2 CTScatterChart (org.openxmlformats.schemas.drawingml.x2006.chart.CTScatterChart)2