Class XDDFChart
java.lang.Object
org.apache.poi.ooxml.POIXMLDocumentPart
org.apache.poi.xddf.usermodel.chart.XDDFChart
- All Implemented Interfaces:
TextContainer
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.poi.ooxml.POIXMLDocumentPart
POIXMLDocumentPart.RelationPart
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected List<XDDFChartAxis>
protected final org.openxmlformats.schemas.drawingml.x2006.chart.CTChart
Chart element in the chart spaceprotected final org.openxmlformats.schemas.drawingml.x2006.chart.CTChartSpace
Root element of the Chart part -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
Construct a chart.protected
XDDFChart
(PackagePart part) Construct a DrawingML chart from a package part. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
commit()
save chart xmlcreateData
(ChartTypes type, XDDFChartAxis category, XDDFValueAxis values) createRelationshipInChart
(POIXMLRelation chartRelation, POIXMLFactory chartFactory, int chartIndex) method to create relationship with embedded part for example writing xlsx file stream into output streamvoid
void
void
protected void
fillSheet
(XSSFSheet sheet, XDDFDataSource<?> categoryData, XDDFNumericalDataSource<?> valuesData) this method writes the data into sheet<R> Optional<R>
findDefinedParagraphProperty
(Function<org.openxmlformats.schemas.drawingml.x2006.main.CTTextParagraphProperties, Boolean> isSet, Function<org.openxmlformats.schemas.drawingml.x2006.main.CTTextParagraphProperties, R> getter) <R> Optional<R>
findDefinedRunProperty
(Function<org.openxmlformats.schemas.drawingml.x2006.main.CTTextCharacterProperties, Boolean> isSet, Function<org.openxmlformats.schemas.drawingml.x2006.main.CTTextCharacterProperties, R> getter) formatRange
(CellRangeAddress range) List<? extends XDDFChartAxis>
getAxes()
protected abstract POIXMLFactory
protected int
protected abstract POIXMLRelation
protected abstract POIXMLRelation
org.openxmlformats.schemas.drawingml.x2006.chart.CTChart
Return the underlying CTChart bean, within the Chart Spaceorg.openxmlformats.schemas.drawingml.x2006.chart.CTChartSpace
Return the underlying CTChartSpace bean, the root element of the Chart part.protected org.openxmlformats.schemas.drawingml.x2006.chart.CTPlotArea
Return the underlying CTPlotArea bean, within the ChartGet the chart title body if there is one, i.e.getTitle()
void
importContent
(XDDFChart other) import content from other chart to created chartboolean
void
plot
(XDDFChartData data) void
saveWorkbook
(XSSFWorkbook workbook) this method write the XSSFWorkbook object data into embedded excel filevoid
setAutoTitleDeleted
(boolean deleted) void
setBackWall
(int thickness) void
setChartIndex
(int chartIndex) set chart index which can be use for relation partvoid
setExternalId
(String id) set the relation id of embedded excel relation id into external data relation tagvoid
setFloor
(int thickness) void
setPlotOnlyVisibleCells
(boolean only) setSheetTitle
(String title, int column) set sheet title in excel filevoid
setSideWall
(int thickness) void
setTitleOverlay
(boolean overlay) void
setTitleText
(String text) Sets the title text as a static string.void
setValueRange
(int axisIndex, Double minimum, Double maximum, Double majorUnit, 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 useMethods inherited from class org.apache.poi.ooxml.POIXMLDocumentPart
_invokeOnDocumentRead, addRelation, createRelationship, createRelationship, createRelationship, getNextPartNumber, getPackagePart, getParent, getRelationById, getRelationId, getRelationPartById, getRelationParts, getRelations, getTargetPart, isCommited, onDocumentCreate, onDocumentRead, onDocumentRemove, onSave, prepareForCommit, read, rebase, removeRelation, removeRelation, removeRelation, setCommited, toString
-
Field Details
-
axes
-
chartSpace
protected final org.openxmlformats.schemas.drawingml.x2006.chart.CTChartSpace chartSpaceRoot element of the Chart part -
chart
protected final org.openxmlformats.schemas.drawingml.x2006.chart.CTChart chartChart element in the chart space
-
-
Constructor Details
-
XDDFChart
protected XDDFChart()Construct a chart. -
XDDFChart
Construct a DrawingML chart from a package part.- Parameters:
part
- the package part holding the chart data, the content type must beapplication/vnd.openxmlformats-officedocument.drawingml.chart+xml
- Throws:
IOException
org.apache.xmlbeans.XmlException
- Since:
- POI 3.14-Beta1
-
-
Method Details
-
getCTChartSpace
Return the underlying CTChartSpace bean, the root element of the Chart part.- Returns:
- the underlying CTChartSpace bean
-
getCTChart
Return the underlying CTChart bean, within the Chart Space- Returns:
- the underlying CTChart bean
-
getCTPlotArea
Return the underlying CTPlotArea bean, within the Chart- Returns:
- the underlying CTPlotArea bean
-
isPlotOnlyVisibleCells
public boolean isPlotOnlyVisibleCells()- Returns:
- true if only visible cells will be present on the chart, false otherwise
-
setPlotOnlyVisibleCells
public void setPlotOnlyVisibleCells(boolean only) - Parameters:
only
- a flag specifying if only visible cells should be present on the chart
-
setFloor
public void setFloor(int thickness) -
setBackWall
public void setBackWall(int thickness) -
setSideWall
public void setSideWall(int thickness) -
setAutoTitleDeleted
public void setAutoTitleDeleted(boolean deleted) -
displayBlanksAs
- Since:
- 4.0.1
-
getTitleOverlay
- Since:
- 4.0.1
-
setTitleOverlay
public void setTitleOverlay(boolean overlay) - Since:
- 4.0.1
-
setTitleText
Sets the title text as a static string.- Parameters:
text
- to use as new title- Since:
- 4.0.1
-
getTitle
- Since:
- 4.0.1
-
getFormattedTitle
Get the chart title body if there is one, i.e. title is set and is not a formula.- Returns:
- text body or null, if title is a formula or no title is set.
-
findDefinedParagraphProperty
public <R> Optional<R> findDefinedParagraphProperty(Function<org.openxmlformats.schemas.drawingml.x2006.main.CTTextParagraphProperties, Boolean> isSet, Function<org.openxmlformats.schemas.drawingml.x2006.main.CTTextParagraphProperties, R> getter) - Specified by:
findDefinedParagraphProperty
in interfaceTextContainer
-
findDefinedRunProperty
public <R> Optional<R> findDefinedRunProperty(Function<org.openxmlformats.schemas.drawingml.x2006.main.CTTextCharacterProperties, Boolean> isSet, Function<org.openxmlformats.schemas.drawingml.x2006.main.CTTextCharacterProperties, R> getter) - Specified by:
findDefinedRunProperty
in interfaceTextContainer
-
getOrAddShapeProperties
-
deleteShapeProperties
public void deleteShapeProperties() -
getOrAddLegend
-
deleteLegend
public void deleteLegend() -
getOrAddManualLayout
-
plot
-
getChartSeries
-
createValueAxis
-
createCategoryAxis
-
createDateAxis
-
createData
-
getAxes
-
setValueRange
public void setValueRange(int axisIndex, Double minimum, Double maximum, Double majorUnit, Double minorUnit) Set value range (basic Axis Options)- Parameters:
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 change
-
createRelationshipInChart
public PackageRelationship createRelationshipInChart(POIXMLRelation chartRelation, POIXMLFactory chartFactory, int chartIndex) method to create relationship with embedded part for example writing xlsx file stream into output stream- Parameters:
chartRelation
- relationship objectchartFactory
- ChartFactory objectchartIndex
- index used to suffix on file- Returns:
- return relation part which used to write relation in .rels file and get relation id
- Since:
- POI 4.0.0
-
saveWorkbook
this method write the XSSFWorkbook object data into embedded excel file- Parameters:
workbook
- XSSFworkbook object- Throws:
IOException
InvalidFormatException
- Since:
- POI 4.0.0
-
getChartRelation
- Returns:
- the chart relation in the implementing subclass.
- Since:
- POI 4.0.0
-
getChartWorkbookRelation
- Returns:
- the chart workbook relation in the implementing subclass.
- Since:
- POI 4.0.0
-
getChartFactory
- Returns:
- the chart factory in the implementing subclass.
- Since:
- POI 4.0.0
-
fillSheet
protected void fillSheet(XSSFSheet sheet, XDDFDataSource<?> categoryData, XDDFNumericalDataSource<?> valuesData) this method writes the data into sheet- Parameters:
sheet
- sheet of embedded excelcategoryData
- category valuesvaluesData
- data values- Since:
- POI 4.0.0
-
importContent
import content from other chart to created chart- Parameters:
other
- chart object- Since:
- POI 4.0.0
-
commit
save chart xml- Overrides:
commit
in classPOIXMLDocumentPart
- Throws:
IOException
- a subclass may throw an IOException if the changes can't be committed
-
setSheetTitle
set sheet title in excel file- Parameters:
title
- title of sheetcolumn
- column index- Returns:
- return cell reference
- Since:
- POI 4.0.0
-
formatRange
- Parameters:
range
-- Returns:
- Since:
- POI 4.0.0
-
getWorkbook
- Returns:
- returns the workbook object of embedded excel file
- Throws:
IOException
InvalidFormatException
- Since:
- POI 4.0.0
-
setWorkbook
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- Parameters:
workbook
- workbook object which we read from chart embedded part- Since:
- POI 4.0.0
-
setExternalId
set the relation id of embedded excel relation id into external data relation tag- Parameters:
id
- relation id of embedded excel relation id into external data relation tag- Since:
- POI 4.0.0
-
getChartIndex
protected int getChartIndex()- Returns:
- method return chart index
- Since:
- POI 4.0.0
-
setChartIndex
public void setChartIndex(int chartIndex) set chart index which can be use for relation part- Parameters:
chartIndex
- chart index which can be use for relation part
-