Search in sources :

Example 1 with CTBubbleChart

use of org.openxmlformats.schemas.drawingml.x2006.chart.CTBubbleChart in project ocvn by devgateway.

the class XSSFBubbleChartData 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 CTBubbleChart ctBubbleChart = (CTBubbleChart) ctChart;
            final CTBubbleSer bubbleSer = ctBubbleChart.addNewSer();
            bubbleSer.addNewIdx().setVal(this.id);
            bubbleSer.addNewOrder().setVal(this.order);
            final CTAxDataSource catDS = bubbleSer.addNewXVal();
            XSSFChartUtil.buildAxDataSource(catDS, this.categories);
            final CTNumDataSource valueDS = bubbleSer.addNewBubbleSize();
            XSSFChartUtil.buildNumDataSource(valueDS, this.values);
            if (isTitleSet()) {
                bubbleSer.setTx(getCTSerTx());
            }
        }
    };
}
Also used : CTBubbleSer(org.openxmlformats.schemas.drawingml.x2006.chart.CTBubbleSer) CTNumDataSource(org.openxmlformats.schemas.drawingml.x2006.chart.CTNumDataSource) XmlObject(org.apache.xmlbeans.XmlObject) CTBubbleChart(org.openxmlformats.schemas.drawingml.x2006.chart.CTBubbleChart) CTAxDataSource(org.openxmlformats.schemas.drawingml.x2006.chart.CTAxDataSource)

Example 2 with CTBubbleChart

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

the class XSSFBubbleChartData 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 CTBubbleChart ctBubbleChart = (CTBubbleChart) ctChart;
            final CTBubbleSer bubbleSer = ctBubbleChart.addNewSer();
            bubbleSer.addNewIdx().setVal(this.id);
            bubbleSer.addNewOrder().setVal(this.order);
            final CTAxDataSource catDS = bubbleSer.addNewXVal();
            XSSFChartUtil.buildAxDataSource(catDS, this.categories);
            final CTNumDataSource valueDS = bubbleSer.addNewBubbleSize();
            XSSFChartUtil.buildNumDataSource(valueDS, this.values);
            if (isTitleSet()) {
                bubbleSer.setTx(getCTSerTx());
            }
        }
    };
}
Also used : CTBubbleSer(org.openxmlformats.schemas.drawingml.x2006.chart.CTBubbleSer) CTNumDataSource(org.openxmlformats.schemas.drawingml.x2006.chart.CTNumDataSource) XmlObject(org.apache.xmlbeans.XmlObject) CTBubbleChart(org.openxmlformats.schemas.drawingml.x2006.chart.CTBubbleChart) CTAxDataSource(org.openxmlformats.schemas.drawingml.x2006.chart.CTAxDataSource)

Example 3 with CTBubbleChart

use of org.openxmlformats.schemas.drawingml.x2006.chart.CTBubbleChart in project ocvn by devgateway.

the class XSSFBubbleChartData 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 CTBubbleChart bubbleChart = plotArea.addNewBubbleChart();
    for (CustomChartSeries s : series) {
        s.addToChart(bubbleChart);
    }
    for (ChartAxis ax : axis) {
        bubbleChart.addNewAxId().setVal(ax.getId());
    }
    xssfChart.setTitle(this.title);
}
Also used : XSSFChart(org.apache.poi.xssf.usermodel.XSSFChart) CustomChartSeries(org.devgateway.toolkit.web.excelcharts.CustomChartSeries) ChartAxis(org.apache.poi.ss.usermodel.charts.ChartAxis) CTPlotArea(org.openxmlformats.schemas.drawingml.x2006.chart.CTPlotArea) CTBubbleChart(org.openxmlformats.schemas.drawingml.x2006.chart.CTBubbleChart)

Example 4 with CTBubbleChart

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

the class XSSFBubbleChartData 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 CTBubbleChart bubbleChart = plotArea.addNewBubbleChart();
    for (CustomChartSeries s : series) {
        s.addToChart(bubbleChart);
    }
    for (ChartAxis ax : axis) {
        bubbleChart.addNewAxId().setVal(ax.getId());
    }
    xssfChart.setTitleText(this.title);
}
Also used : XSSFChart(org.apache.poi.xssf.usermodel.XSSFChart) CustomChartSeries(org.devgateway.toolkit.web.excelcharts.CustomChartSeries) ChartAxis(org.apache.poi.ss.usermodel.charts.ChartAxis) CTPlotArea(org.openxmlformats.schemas.drawingml.x2006.chart.CTPlotArea) CTBubbleChart(org.openxmlformats.schemas.drawingml.x2006.chart.CTBubbleChart)

Aggregations

CTBubbleChart (org.openxmlformats.schemas.drawingml.x2006.chart.CTBubbleChart)4 ChartAxis (org.apache.poi.ss.usermodel.charts.ChartAxis)2 XSSFChart (org.apache.poi.xssf.usermodel.XSSFChart)2 XmlObject (org.apache.xmlbeans.XmlObject)2 CustomChartSeries (org.devgateway.toolkit.web.excelcharts.CustomChartSeries)2 CTAxDataSource (org.openxmlformats.schemas.drawingml.x2006.chart.CTAxDataSource)2 CTBubbleSer (org.openxmlformats.schemas.drawingml.x2006.chart.CTBubbleSer)2 CTNumDataSource (org.openxmlformats.schemas.drawingml.x2006.chart.CTNumDataSource)2 CTPlotArea (org.openxmlformats.schemas.drawingml.x2006.chart.CTPlotArea)2