Search in sources :

Example 6 with CustomChartSeries

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

the class AbstractXSSFChartData method addSeries.

@Override
public CustomChartSeries addSeries(final String title, final ChartDataSource<?> categoryAxisData, final ChartDataSource<? extends Number> values) {
    if (!values.isNumeric()) {
        throw new IllegalArgumentException("Value data source must be numeric.");
    }
    int numOfSeries = series.size();
    final CustomChartSeries newSeries = createNewSerie(numOfSeries, numOfSeries, categoryAxisData, values);
    if (title != null) {
        newSeries.setTitle(title);
    }
    series.add(newSeries);
    return newSeries;
}
Also used : CustomChartSeries(org.devgateway.toolkit.web.excelcharts.CustomChartSeries)

Example 7 with CustomChartSeries

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

the class XSSFPieChartData 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 CTPieChart pieChart = plotArea.addNewPieChart();
    pieChart.addNewVaryColors().setVal(true);
    xssfChart.setTitleText(this.title);
    for (CustomChartSeries s : series) {
        s.addToChart(pieChart);
    }
}
Also used : CTPieChart(org.openxmlformats.schemas.drawingml.x2006.chart.CTPieChart) XSSFChart(org.apache.poi.xssf.usermodel.XSSFChart) CustomChartSeries(org.devgateway.toolkit.web.excelcharts.CustomChartSeries) CTPlotArea(org.openxmlformats.schemas.drawingml.x2006.chart.CTPlotArea)

Example 8 with CustomChartSeries

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

the class XSSFBarChartData 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);
    // 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 9 with CustomChartSeries

use of org.devgateway.toolkit.web.excelcharts.CustomChartSeries 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 10 with CustomChartSeries

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

the class XSSFPieChartData 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 CTPieChart pieChart = plotArea.addNewPieChart();
    pieChart.addNewVaryColors().setVal(true);
    xssfChart.setTitle(this.title);
    for (CustomChartSeries s : series) {
        s.addToChart(pieChart);
    }
}
Also used : CTPieChart(org.openxmlformats.schemas.drawingml.x2006.chart.CTPieChart) XSSFChart(org.apache.poi.xssf.usermodel.XSSFChart) CustomChartSeries(org.devgateway.toolkit.web.excelcharts.CustomChartSeries) CTPlotArea(org.openxmlformats.schemas.drawingml.x2006.chart.CTPlotArea)

Aggregations

CustomChartSeries (org.devgateway.toolkit.web.excelcharts.CustomChartSeries)16 XSSFChart (org.apache.poi.xssf.usermodel.XSSFChart)14 CTPlotArea (org.openxmlformats.schemas.drawingml.x2006.chart.CTPlotArea)14 ChartAxis (org.apache.poi.ss.usermodel.charts.ChartAxis)12 CTValAx (org.openxmlformats.schemas.drawingml.x2006.chart.CTValAx)10 CTBarChart (org.openxmlformats.schemas.drawingml.x2006.chart.CTBarChart)4 CTCatAx (org.openxmlformats.schemas.drawingml.x2006.chart.CTCatAx)4 CTAreaChart (org.openxmlformats.schemas.drawingml.x2006.chart.CTAreaChart)2 CTBubbleChart (org.openxmlformats.schemas.drawingml.x2006.chart.CTBubbleChart)2 CTLineChart (org.openxmlformats.schemas.drawingml.x2006.chart.CTLineChart)2 CTPieChart (org.openxmlformats.schemas.drawingml.x2006.chart.CTPieChart)2 CTScatterChart (org.openxmlformats.schemas.drawingml.x2006.chart.CTScatterChart)2