use of org.openxmlformats.schemas.drawingml.x2006.chart.CTAreaChart in project ocvn by devgateway.
the class XSSFAreaChartData 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 CTAreaChart ctAreaChart = (CTAreaChart) ctChart;
final CTAreaSer ctAreaSer = ctAreaChart.addNewSer();
ctAreaSer.addNewIdx().setVal(this.id);
ctAreaSer.addNewOrder().setVal(this.order);
final CTAxDataSource catDS = ctAreaSer.addNewCat();
XSSFChartUtil.buildAxDataSource(catDS, this.categories);
final CTNumDataSource valueDS = ctAreaSer.addNewVal();
XSSFChartUtil.buildNumDataSource(valueDS, this.values);
if (isTitleSet()) {
ctAreaSer.setTx(getCTSerTx());
}
}
};
}
use of org.openxmlformats.schemas.drawingml.x2006.chart.CTAreaChart 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());
}
}
Aggregations