@Beta public abstract class XDDFChart extends POIXMLDocumentPart implements TextContainer
POIXMLDocumentPart.RelationPart
Modifier and Type | Field and Description |
---|---|
protected java.util.List<XDDFChartAxis> |
axes |
protected org.openxmlformats.schemas.drawingml.x2006.chart.CTChartSpace |
chartSpace
Root element of the Chart part
|
static int |
DEFAULT_HEIGHT
default height of chart in emu
|
static int |
DEFAULT_WIDTH
default width of chart in emu
|
static int |
DEFAULT_X
default x-coordinate of chart in emu
|
static int |
DEFAULT_Y
default y-coordinate value of chart in emu
|
Modifier | Constructor and Description |
---|---|
protected |
XDDFChart()
Construct a chart.
|
protected |
XDDFChart(PackagePart part)
Construct a DrawingML chart from a package part.
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
Clear all properties, as if a new instance had just been created.
|
void |
clearChartSeries()
Clear all chart series, as if a new instance had just been created.
|
protected void |
commit()
save chart xml
|
XDDFCategoryAxis |
createCategoryAxis(AxisPosition pos) |
XDDFChartData |
createData(ChartTypes type,
XDDFChartAxis category,
XDDFValueAxis values)
this method will return specified chart data with category and series values
|
XDDFDateAxis |
createDateAxis(AxisPosition pos) |
PackageRelationship |
createRelationshipInChart(POIXMLRelation chartRelation,
POIXMLFactory chartFactory,
int chartIndex)
method to create relationship with embedded part for example writing xlsx
file stream into output stream
|
XDDFSeriesAxis |
createSeriesAxis(AxisPosition pos)
this method will return series axis with specified position
|
XDDFValueAxis |
createValueAxis(AxisPosition pos) |
void |
deleteLegend() |
void |
deleteShapeProperties() |
void |
displayBlanksAs(DisplayBlanks as) |
protected void |
fillSheet(XSSFSheet sheet,
XDDFDataSource<?> categoryData,
XDDFNumericalDataSource<?> valuesData)
this method writes the data into sheet
|
<R> java.util.Optional<R> |
findDefinedParagraphProperty(java.util.function.Predicate<org.openxmlformats.schemas.drawingml.x2006.main.CTTextParagraphProperties> isSet,
java.util.function.Function<org.openxmlformats.schemas.drawingml.x2006.main.CTTextParagraphProperties,R> getter) |
<R> java.util.Optional<R> |
findDefinedRunProperty(java.util.function.Predicate<org.openxmlformats.schemas.drawingml.x2006.main.CTTextCharacterProperties> isSet,
java.util.function.Function<org.openxmlformats.schemas.drawingml.x2006.main.CTTextCharacterProperties,R> getter) |
java.lang.String |
formatRange(CellRangeAddress range) |
java.util.List<? extends XDDFChartAxis> |
getAxes() |
protected abstract POIXMLFactory |
getChartFactory() |
protected int |
getChartIndex() |
protected abstract POIXMLRelation |
getChartRelation() |
java.util.List<XDDFChartData> |
getChartSeries() |
protected abstract POIXMLRelation |
getChartWorkbookRelation() |
org.openxmlformats.schemas.drawingml.x2006.chart.CTChart |
getCTChart()
Return the underlying CTChart bean, within the Chart Space
|
org.openxmlformats.schemas.drawingml.x2006.chart.CTChartSpace |
getCTChartSpace()
Return the underlying CTChartSpace bean, the root element of the Chart
part.
|
protected org.openxmlformats.schemas.drawingml.x2006.chart.CTPlotArea |
getCTPlotArea()
Return the underlying CTPlotArea bean, within the Chart
|
XDDFTextBody |
getFormattedTitle()
Get the chart title body if there is one, i.e.
|
XDDFChartLegend |
getOrAddLegend() |
XDDFManualLayout |
getOrAddManualLayout() |
XDDFShapeProperties |
getOrAddShapeProperties() |
XDDFView3D |
getOrAddView3D()
Get or Add chart 3D view into chart
|
XDDFTitle |
getTitle() |
java.lang.Boolean |
getTitleOverlay() |
XSSFWorkbook |
getWorkbook() |
void |
importContent(XDDFChart other)
import content from other chart to created chart
|
protected long |
incrementSeriesCount() |
boolean |
isPlotOnlyVisibleCells() |
void |
plot(XDDFChartData data) |
void |
removeTitle()
Remove the chart title.
|
void |
replaceReferences(XSSFSheet newSheet)
Replace references to the sheet name in the data supporting the chart.
|
void |
saveWorkbook(XSSFWorkbook workbook)
this method write the XSSFWorkbook object data into embedded excel file
|
void |
setAutoTitleDeleted(boolean deleted) |
void |
setBackWall(int thickness) |
void |
setChartIndex(int chartIndex)
Set chart index which can be used for relation part.
|
void |
setExternalId(java.lang.String id)
set the relation id of embedded excel relation id into external data
relation tag
|
void |
setFloor(int thickness) |
void |
setPlotOnlyVisibleCells(boolean only) |
CellReference |
setSheetTitle(java.lang.String title,
int column)
set sheet title in excel file
|
void |
setSideWall(int thickness) |
void |
setTitleOverlay(boolean overlay) |
void |
setTitleText(java.lang.String text)
Sets the title text as a static string.
|
void |
setValueRange(int axisIndex,
java.lang.Double minimum,
java.lang.Double maximum,
java.lang.Double majorUnit,
java.lang.Double minorUnit)
Set value range (basic Axis Options)
|
void |
setWorkbook(XSSFWorkbook workbook)
while reading chart from template file then we need to parse and store
embedded excel file in chart object show that we can modify value
according to use
|
_invokeOnDocumentRead, addRelation, createRelationship, createRelationship, createRelationship, getNextPartNumber, getPackagePart, getParent, getRelationById, getRelationId, getRelationPartById, getRelationParts, getRelations, getTargetPart, isCommitted, onDocumentCreate, onDocumentRead, onDocumentRemove, onSave, prepareForCommit, read, rebase, removeRelation, removeRelation, removeRelation, setCommitted, toString
public static final int DEFAULT_WIDTH
public static final int DEFAULT_HEIGHT
public static final int DEFAULT_X
public static final int DEFAULT_Y
protected java.util.List<XDDFChartAxis> axes
protected final org.openxmlformats.schemas.drawingml.x2006.chart.CTChartSpace chartSpace
protected XDDFChart()
protected XDDFChart(PackagePart part) throws java.io.IOException, org.apache.xmlbeans.XmlException
part
- the package part holding the chart data, the content type must
be
application/vnd.openxmlformats-officedocument.drawingml.chart+xml
java.io.IOException
org.apache.xmlbeans.XmlException
@Internal public org.openxmlformats.schemas.drawingml.x2006.chart.CTChartSpace getCTChartSpace()
@Internal public org.openxmlformats.schemas.drawingml.x2006.chart.CTChart getCTChart()
@Internal protected org.openxmlformats.schemas.drawingml.x2006.chart.CTPlotArea getCTPlotArea()
public void clear()
public boolean isPlotOnlyVisibleCells()
public void setPlotOnlyVisibleCells(boolean only)
only
- a flag specifying if only visible cells should be present on
the chartpublic void setFloor(int thickness)
public void setBackWall(int thickness)
public void setSideWall(int thickness)
public void setAutoTitleDeleted(boolean deleted)
public void displayBlanksAs(DisplayBlanks as)
public java.lang.Boolean getTitleOverlay()
public void setTitleOverlay(boolean overlay)
public void setTitleText(java.lang.String text)
text
- to use as new titlepublic XDDFTitle getTitle()
public void removeTitle()
public XDDFView3D getOrAddView3D()
@Beta public XDDFTextBody getFormattedTitle()
public <R> java.util.Optional<R> findDefinedParagraphProperty(java.util.function.Predicate<org.openxmlformats.schemas.drawingml.x2006.main.CTTextParagraphProperties> isSet, java.util.function.Function<org.openxmlformats.schemas.drawingml.x2006.main.CTTextParagraphProperties,R> getter)
findDefinedParagraphProperty
in interface TextContainer
public <R> java.util.Optional<R> findDefinedRunProperty(java.util.function.Predicate<org.openxmlformats.schemas.drawingml.x2006.main.CTTextCharacterProperties> isSet, java.util.function.Function<org.openxmlformats.schemas.drawingml.x2006.main.CTTextCharacterProperties,R> getter)
findDefinedRunProperty
in interface TextContainer
public XDDFShapeProperties getOrAddShapeProperties()
public void deleteShapeProperties()
public XDDFChartLegend getOrAddLegend()
public void deleteLegend()
public XDDFManualLayout getOrAddManualLayout()
protected long incrementSeriesCount()
public void plot(XDDFChartData data)
public java.util.List<XDDFChartData> getChartSeries()
public void clearChartSeries()
public XDDFValueAxis createValueAxis(AxisPosition pos)
public XDDFSeriesAxis createSeriesAxis(AxisPosition pos)
pos
- axis position Left, Right, Top, Bottompublic XDDFCategoryAxis createCategoryAxis(AxisPosition pos)
public XDDFDateAxis createDateAxis(AxisPosition pos)
public XDDFChartData createData(ChartTypes type, XDDFChartAxis category, XDDFValueAxis values)
type
- chart typecategory
- category values of chartvalues
- series values of chartpublic java.util.List<? extends XDDFChartAxis> getAxes()
public void setValueRange(int axisIndex, java.lang.Double minimum, java.lang.Double maximum, java.lang.Double majorUnit, java.lang.Double minorUnit)
axisIndex
- 0 - primary axis, 1 - secondary axisminimum
- minimum value; Double.NaN - automatic; null - no changemaximum
- maximum value; Double.NaN - automatic; null - no changemajorUnit
- major unit value; Double.NaN - automatic; null - no changeminorUnit
- minor unit value; Double.NaN - automatic; null - no changepublic PackageRelationship createRelationshipInChart(POIXMLRelation chartRelation, POIXMLFactory chartFactory, int chartIndex)
chartRelation
- relationship objectchartFactory
- ChartFactory objectchartIndex
- index used to suffix on filepublic void saveWorkbook(XSSFWorkbook workbook) throws java.io.IOException, InvalidFormatException
workbook
- XSSFworkbook objectjava.io.IOException
InvalidFormatException
protected abstract POIXMLRelation getChartRelation()
protected abstract POIXMLRelation getChartWorkbookRelation()
protected abstract POIXMLFactory getChartFactory()
protected void fillSheet(XSSFSheet sheet, XDDFDataSource<?> categoryData, XDDFNumericalDataSource<?> valuesData)
sheet
- sheet of embedded excelcategoryData
- category valuesvaluesData
- data valuespublic void importContent(XDDFChart other)
other
- chart objectprotected void commit() throws java.io.IOException
commit
in class POIXMLDocumentPart
java.io.IOException
- a subclass may throw an IOException if the changes can't be committedpublic CellReference setSheetTitle(java.lang.String title, int column)
title
- title of sheetcolumn
- column indexpublic java.lang.String formatRange(CellRangeAddress range)
public XSSFWorkbook getWorkbook() throws java.io.IOException, InvalidFormatException
java.io.IOException
InvalidFormatException
public void setWorkbook(XSSFWorkbook workbook)
workbook
- workbook object which we read from chart embedded partpublic void setExternalId(java.lang.String id)
id
- relation id of embedded excel relation id into external data
relation tagprotected int getChartIndex()
public void setChartIndex(int chartIndex)
chartIndex
- chart index which can be used for relation part.public void replaceReferences(XSSFSheet newSheet)
newSheet
- sheet to be used in the data references.Copyright 2022 The Apache Software Foundation or its licensors, as applicable.