/** * Creates a chart. * * @param anchor * the client anchor describes how this chart is attached to the * sheet. * @return the newly created chart * @see org.apache.poi.xssf.usermodel.XSSFDrawing#createChart(ClientAnchor) */ public XSSFChart createChart(XSSFClientAnchor anchor) { int chartNumber = getPackagePart().getPackage().getPartsByContentType(XSSFRelation.CHART.getContentType()) .size() + 1; RelationPart rp = createRelationship(XSSFRelation.CHART, XSSFFactory.getInstance(), chartNumber, false); XSSFChart chart = rp.getDocumentPart(); String chartRelId = rp.getRelationship().getId(); XSSFGraphicFrame frame = createGraphicFrame(anchor); frame.setChart(chart, chartRelId); frame.getCTGraphicalObjectFrame().setXfrm(createXfrm(anchor)); return chart; }
/** * Creates a chart. * @param anchor the client anchor describes how this chart is attached to * the sheet. * @return the newly created chart * @see org.apache.poi.xssf.usermodel.XSSFDrawing#createChart(ClientAnchor) */ public XSSFChart createChart(XSSFClientAnchor anchor) { int chartNumber = getPackagePart().getPackage(). getPartsByContentType(XSSFRelation.CHART.getContentType()).size() + 1; XSSFChart chart = (XSSFChart) createRelationship( XSSFRelation.CHART, XSSFFactory.getInstance(), chartNumber); String chartRelId = chart.getPackageRelationship().getId(); XSSFGraphicFrame frame = createGraphicFrame(anchor); frame.setChart(chart, chartRelId); return chart; }
/** * Creates a chart. * * @param anchor * the client anchor describes how this chart is attached to the * sheet. * @return the newly created chart * @see org.apache.poi.xssf.usermodel.XSSFDrawing#createChart(ClientAnchor) */ public XSSFChart createChart(XSSFClientAnchor anchor) { int chartNumber = getPackagePart().getPackage().getPartsByContentType(XSSFRelation.CHART.getContentType()) .size() + 1; RelationPart rp = createRelationship(XSSFRelation.CHART, XSSFFactory.getInstance(), chartNumber, false); XSSFChart chart = rp.getDocumentPart(); String chartRelId = rp.getRelationship().getId(); XSSFGraphicFrame frame = createGraphicFrame(anchor); frame.setChart(chart, chartRelId); frame.getCTGraphicalObjectFrame().setXfrm(createXfrm(anchor)); return chart; }