/** * Creates a chart. * * @param anchor * the client anchor describes how this chart is attached to the * sheet. * @return the newly created chart */ public XSSFChart createChart(ClientAnchor anchor) { return createChart((XSSFClientAnchor) anchor); }
/** * Imports the chart from the <code>srcChart</code> into this drawing. * * @param srcChart * the source chart to be cloned into this drawing. * @return the newly created chart. * @throws XmlException * @throws IOException * @since 4.0.0 */ public XSSFChart importChart(XSSFChart srcChart) throws IOException, XmlException { CTTwoCellAnchor anchor = ((XSSFDrawing) srcChart.getParent()).getCTDrawing().getTwoCellAnchorArray(0); CTMarker from = (CTMarker) anchor.getFrom().copy(); CTMarker to = (CTMarker) anchor.getTo().copy(); XSSFClientAnchor destAnchor = new XSSFClientAnchor(from, to); destAnchor.setAnchorType(ClientAnchor.AnchorType.MOVE_AND_RESIZE); XSSFChart destChart = createChart(destAnchor); destChart.getCTChartSpace().set(srcChart.getCTChartSpace().copy()); destChart.getCTChart().set(srcChart.getCTChart().copy()); return destChart; }
/** * Creates a chart. * * @param anchor * the client anchor describes how this chart is attached to the * sheet. * @return the newly created chart */ public XSSFChart createChart(ClientAnchor anchor) { return createChart((XSSFClientAnchor) anchor); }
public XSSFChart createChart(ClientAnchor anchor) { return createChart((XSSFClientAnchor)anchor); }
XSSFClientAnchor anchor = drawing.createAnchor(0, 0, 0, 0, 0, 5, 10, 15); XSSFChart chart = drawing.createChart(anchor); XDDFChartLegend legend = chart.getOrAddLegend(); legend.setPosition(LegendPosition.TOP_RIGHT);
XSSFClientAnchor anchor = drawing.createAnchor(0, 0, 0, 0, 0, 5, 10, 15); XSSFChart chart = drawing.createChart(anchor); chart.setTitleText("x = 2x and x = 3x"); chart.setTitleOverlay(false);
XSSFClientAnchor anchor = drawing.createAnchor(0, 0, 0, 0, 0, 5, 10, 15); XSSFChart chart = drawing.createChart(anchor); XDDFChartLegend legend = chart.getOrAddLegend(); legend.setPosition(LegendPosition.TOP_RIGHT);
/** * Imports the chart from the <code>srcChart</code> into this drawing. * * @param srcChart * the source chart to be cloned into this drawing. * @return the newly created chart. * @throws XmlException * @throws IOException * @since 4.0.0 */ public XSSFChart importChart(XSSFChart srcChart) throws IOException, XmlException { CTTwoCellAnchor anchor = ((XSSFDrawing) srcChart.getParent()).getCTDrawing().getTwoCellAnchorArray(0); CTMarker from = (CTMarker) anchor.getFrom().copy(); CTMarker to = (CTMarker) anchor.getTo().copy(); XSSFClientAnchor destAnchor = new XSSFClientAnchor(from, to); destAnchor.setAnchorType(ClientAnchor.AnchorType.MOVE_AND_RESIZE); XSSFChart destChart = createChart(destAnchor); destChart.getCTChartSpace().set(srcChart.getCTChartSpace().copy()); destChart.getCTChart().set(srcChart.getCTChart().copy()); return destChart; }
XSSFClientAnchor anchor = drawing.createAnchor(0, 0, 0, 0, 4, 0, 11, 15); XSSFChart chart = drawing.createChart(anchor); chart.setTitleText("This is my title"); chart.setTitleOverlay(true);