org.apache.poi.xddf.usermodel.chart

## Class XDDFChart

- java.lang.Object
- - org.apache.poi.ooxml.POIXMLDocumentPart
  - - org.apache.poi.xddf.usermodel.chart.XDDFChart

- All Implemented Interfaces:
    TextContainer
  Direct Known Subclasses:
    XSLFChart, XSSFChart, XWPFChart

      @Beta
      public abstract class XDDFChart
      extends POIXMLDocumentPart
      implements TextContainer

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class org.apache.poi.ooxml.POIXMLDocumentPart

      `POIXMLDocumentPart.RelationPart`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected java.util.List<XDDFChartAxis>` | `axes`
    `protected org.openxmlformats.schemas.drawingml.x2006.chart.CTChart` | `chart` Chart element in the chart space
    `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

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `XDDFChart()` Construct a chart.
    `protected` | `XDDFChart(PackagePart part)` Construct a DrawingML chart from a package part.

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    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.Function<org.openxmlformats.schemas.drawingml.x2006.main.CTTextParagraphProperties,java.lang.Boolean> isSet, java.util.function.Function<org.openxmlformats.schemas.drawingml.x2006.main.CTTextParagraphProperties,R> getter)`
    `<R> java.util.Optional<R>` | `findDefinedRunProperty(java.util.function.Function<org.openxmlformats.schemas.drawingml.x2006.main.CTTextCharacterProperties,java.lang.Boolean> 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` | `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 use 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

    - ### Methods inherited from class org.apache.poi.ooxml.POIXMLDocumentPart

      `_invokeOnDocumentRead, addRelation, createRelationship, createRelationship, createRelationship, getNextPartNumber, getPackagePart, getParent, getRelationById, getRelationId, getRelationPartById, getRelationParts, getRelations, getTargetPart, isCommited, isCommitted, onDocumentCreate, onDocumentRead, onDocumentRemove, onSave, prepareForCommit, read, rebase, removeRelation, removeRelation, removeRelation, setCommited, setCommitted, toString`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### DEFAULT_WIDTH

          public static final int DEFAULT_WIDTH

      default width of chart in emu
      See Also:
        Constant Field Values

    - #### DEFAULT_HEIGHT

          public static final int DEFAULT_HEIGHT

      default height of chart in emu
      See Also:
        Constant Field Values

    - #### DEFAULT_X

          public static final int DEFAULT_X

      default x-coordinate of chart in emu
      See Also:
        Constant Field Values

    - #### DEFAULT_Y

          public static final int DEFAULT_Y

      default y-coordinate value of chart in emu
      See Also:
        Constant Field Values

    - #### axes

          protected java.util.List<XDDFChartAxis> axes

    - #### chartSpace

          protected final org.openxmlformats.schemas.drawingml.x2006.chart.CTChartSpace chartSpace

      Root element of the Chart part

    - #### chart

          protected final org.openxmlformats.schemas.drawingml.x2006.chart.CTChart chart

      Chart element in the chart space

  - ### Constructor Detail

    - #### XDDFChart

          protected XDDFChart()

      Construct a chart.

    - #### XDDFChart

          protected XDDFChart(PackagePart part)
                       throws java.io.IOException,
                              org.apache.xmlbeans.XmlException

      Construct a DrawingML chart from a package part.
      Parameters:
        `part` - the package part holding the chart data, the content type must be `application/vnd.openxmlformats-officedocument.drawingml.chart+xml`
      Throws:
        `java.io.IOException`
        `org.apache.xmlbeans.XmlException`
      Since:
        POI 3.14-Beta1

  - ### Method Detail

    - #### getCTChartSpace

          @Internal
          public org.openxmlformats.schemas.drawingml.x2006.chart.CTChartSpace getCTChartSpace()

      Return the underlying CTChartSpace bean, the root element of the Chart part.
      Returns:
        the underlying CTChartSpace bean

    - #### getCTChart

          @Internal
          public org.openxmlformats.schemas.drawingml.x2006.chart.CTChart getCTChart()

      Return the underlying CTChart bean, within the Chart Space
      Returns:
        the underlying CTChart bean

    - #### getCTPlotArea

          @Internal
          protected org.openxmlformats.schemas.drawingml.x2006.chart.CTPlotArea getCTPlotArea()

      Return the underlying CTPlotArea bean, within the Chart
      Returns:
        the underlying CTPlotArea bean

    - #### clear

          public void clear()

      Clear all properties, as if a new instance had just been created.
      Since:
        POI 4.1.2

    - #### 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

          public void displayBlanksAs(DisplayBlanks as)

      Since:
        4.0.1

    - #### getTitleOverlay

          public java.lang.Boolean getTitleOverlay()

      Since:
        4.0.1

    - #### setTitleOverlay

          public void setTitleOverlay(boolean overlay)

      Since:
        4.0.1

    - #### setTitleText

          public void setTitleText(java.lang.String text)

      Sets the title text as a static string.
      Parameters:
        `text` - to use as new title
      Since:
        4.0.1

    - #### getTitle

          public XDDFTitle getTitle()

      Since:
        4.0.1

    - #### getOrAddView3D

          public XDDFView3D getOrAddView3D()

      Get or Add chart 3D view into chart
      Returns:
        this method will add 3D view

    - #### getFormattedTitle

          @Beta
          public XDDFTextBody 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> java.util.Optional<R> findDefinedParagraphProperty(java.util.function.Function<org.openxmlformats.schemas.drawingml.x2006.main.CTTextParagraphProperties,java.lang.Boolean> isSet,
                                                                        java.util.function.Function<org.openxmlformats.schemas.drawingml.x2006.main.CTTextParagraphProperties,R> getter)

      Specified by:
        `findDefinedParagraphProperty` in interface `TextContainer`

    - #### findDefinedRunProperty

          public <R> java.util.Optional<R> findDefinedRunProperty(java.util.function.Function<org.openxmlformats.schemas.drawingml.x2006.main.CTTextCharacterProperties,java.lang.Boolean> isSet,
                                                                  java.util.function.Function<org.openxmlformats.schemas.drawingml.x2006.main.CTTextCharacterProperties,R> getter)

      Specified by:
        `findDefinedRunProperty` in interface `TextContainer`

    - #### getOrAddShapeProperties

          public XDDFShapeProperties getOrAddShapeProperties()

    - #### deleteShapeProperties

          public void deleteShapeProperties()

    - #### getOrAddLegend

          public XDDFChartLegend getOrAddLegend()

    - #### deleteLegend

          public void deleteLegend()

    - #### getOrAddManualLayout

          public XDDFManualLayout getOrAddManualLayout()

    - #### incrementSeriesCount

          protected long incrementSeriesCount()

    - #### plot

          public void plot(XDDFChartData data)

    - #### getChartSeries

          public java.util.List<XDDFChartData> getChartSeries()

    - #### clearChartSeries

          public void clearChartSeries()

      Clear all chart series, as if a new instance had just been created.
      Since:
        POI 4.1.2

    - #### createValueAxis

          public XDDFValueAxis createValueAxis(AxisPosition pos)

    - #### createSeriesAxis

          public XDDFSeriesAxis createSeriesAxis(AxisPosition pos)

      this method will return series axis with specified position
      Parameters:
        `pos` - axis position Left, Right, Top, Bottom
      Returns:
        series axis with specified position

    - #### createCategoryAxis

          public XDDFCategoryAxis createCategoryAxis(AxisPosition pos)

    - #### createDateAxis

          public XDDFDateAxis createDateAxis(AxisPosition pos)

    - #### createData

          public XDDFChartData createData(ChartTypes type,
                                          XDDFChartAxis category,
                                          XDDFValueAxis values)

      this method will return specified chart data with category and series values
      Parameters:
        `type` - chart type
        `category` - category values of chart
        `values` - series values of chart
      Returns:
        specified chart data.

    - #### getAxes

          public java.util.List<? extends XDDFChartAxis> getAxes()

    - #### setValueRange

          public 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)
      Parameters:
        `axisIndex` - 0 - primary axis, 1 - secondary axis
        `minimum` - minimum value; Double.NaN - automatic; null - no change
        `maximum` - maximum value; Double.NaN - automatic; null - no change
        `majorUnit` - major unit value; Double.NaN - automatic; null - no change
        `minorUnit` - 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 object
        `chartFactory` - ChartFactory object
        `chartIndex` - 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

          public void saveWorkbook(XSSFWorkbook workbook)
                            throws java.io.IOException,
                                   InvalidFormatException

      this method write the XSSFWorkbook object data into embedded excel file
      Parameters:
        `workbook` - XSSFworkbook object
      Throws:
        `java.io.IOException`
        `InvalidFormatException`
      Since:
        POI 4.0.0

    - #### getChartRelation

          protected abstract POIXMLRelation getChartRelation()

      Returns:
        the chart relation in the implementing subclass.
      Since:
        POI 4.0.0

    - #### getChartWorkbookRelation

          protected abstract POIXMLRelation getChartWorkbookRelation()

      Returns:
        the chart workbook relation in the implementing subclass.
      Since:
        POI 4.0.0

    - #### getChartFactory

          protected abstract POIXMLFactory 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 excel
        `categoryData` - category values
        `valuesData` - data values
      Since:
        POI 4.0.0

    - #### importContent

          public void importContent(XDDFChart other)

      import content from other chart to created chart
      Parameters:
        `other` - chart object
      Since:
        POI 4.0.0

    - #### commit

          protected void commit()
                         throws java.io.IOException

      save chart xml
      Overrides:
        `commit` in class `POIXMLDocumentPart`
      Throws:
        `java.io.IOException` - a subclass may throw an IOException if the changes can't be committed

    - #### setSheetTitle

          public CellReference setSheetTitle(java.lang.String title,
                                             int column)

      set sheet title in excel file
      Parameters:
        `title` - title of sheet
        `column` - column index
      Returns:
        return cell reference
      Since:
        POI 4.0.0

    - #### formatRange

          public java.lang.String formatRange(CellRangeAddress range)

      Parameters:
        `range` -
      Returns:
      Since:
        POI 4.0.0

    - #### getWorkbook

          public XSSFWorkbook getWorkbook()
                                   throws java.io.IOException,
                                          InvalidFormatException

      Returns:
        returns the workbook object of embedded excel file
      Throws:
        `java.io.IOException`
        `InvalidFormatException`
      Since:
        POI 4.0.0

    - #### setWorkbook

          public 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
      Parameters:
        `workbook` - workbook object which we read from chart embedded part
      Since:
        POI 4.0.0

    - #### setExternalId

          public void setExternalId(java.lang.String id)

      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

Copyright 2020 The Apache Software Foundation or its licensors, as applicable.