com.aspose.slides

Interfaces

Classes

Exceptions

com.aspose.slides

Class ChartData

  • java.lang.Object
    • com.aspose.slides.ChartData
  • All Implemented Interfaces:
    IChartData


    public class ChartData
    extends java.lang.Object
    implements IChartData

    Represents data used for a chart plotting.

    • Method Detail

      • getSeriesGroups

        public final IChartSeriesGroupCollection getSeriesGroups()

        Gets the groups of series. Read-only IChartSeriesGroupCollection.


        1) Each group of series contains series with combinable types. Groups of combinable series types defined and described with CombinableSeriesTypesGroup enum. Also each group of series contains series witch is plotted whether on primary axes or on secondary axes (not both cases in one group). So, principle of series grouping is a grouping by type groups mentioned above and by primary/secondary plotting type. 2) Group of series contains some series properies whitch is common for each series in group ("series group properties"). "Series group properties" in ChartSeriesGroup class is read/write. Each of "series group properties" can have a read-only projection in ChartSeries class.
        Specified by:
        getSeriesGroups in interface IChartData
      • getUseSecondaryCategories

        public final boolean getUseSecondaryCategories()

        If false then getSecondaryCategories() property return null and data in getCategories() property is used both for primary and secondary series. If true then data in getSecondaryCategories() property is used for secondary series and data in getCategories() property is used for primary series. Read/write boolean.


         Example. What categories are related to series - ChartData.getCategories() or ChartData.getSecondaryCategories()?
         
         if (series.getPlotOnSecondAxis() && series.getChart().getChartData().getUseSecondaryCategories())
         {
             // related categories are series.getChart().getChartData().getSecondaryCategories()
         }
         else
         {
             // related categories are series.getChart().getChartData().getCategories()
         }
        Specified by:
        getUseSecondaryCategories in interface IChartData
      • setUseSecondaryCategories

        public final void setUseSecondaryCategories(boolean value)

        If false then getSecondaryCategories() property return null and data in getCategories() property is used both for primary and secondary series. If true then data in getSecondaryCategories() property is used for secondary series and data in getCategories() property is used for primary series. Read/write boolean.


         Example. What categories are related to series - ChartData.getCategories() or ChartData.getSecondaryCategories()?
         
         if (series.getPlotOnSecondAxis() && series.getChart().getChartData().getUseSecondaryCategories())
         {
             // related categories are series.getChart().getChartData().getSecondaryCategories()
         }
         else
         {
             // related categories are series.getChart().getChartData().getCategories()
         }
        Specified by:
        setUseSecondaryCategories in interface IChartData
      • readWorkbookStream

        public final byte[] readWorkbookStream()

        Writes the internally contained Excel workbook it into an in-memory stream.

        Specified by:
        readWorkbookStream in interface IChartData
        Returns:
        Returns an instance of MemoryStream containing a copy of the internally contained Excel workbook.
      • writeWorkbookStream

        public final void writeWorkbookStream(byte[] ms)

        Initializes the internally contained Excel workbook with user-specified value.

        Specified by:
        writeWorkbookStream in interface IChartData
        Parameters:
        ms - The user-supplied stream containing the entire Excel workbook.
      • getDataSourceType

        public final int getDataSourceType()

        Represents external workbook path if external data source, null otherwise

        Specified by:
        getDataSourceType in interface IChartData
      • getExternalWorkbookPath

        public final java.lang.String getExternalWorkbookPath()

        Represents data source of the chart

        Specified by:
        getExternalWorkbookPath in interface IChartData
      • setRange

        public final void setRange(java.lang.String formula)

        Set chart data range. Series and categories will be updated based on new data range. If amount of series in data range greater than count of series in the chart data then additional series with the same type as a last series in the current collection will be added to the end of the collection.

        Specified by:
        setRange in interface IChartData
        Parameters:
        formula - The cells data range formula. E.g: "Sheet1!$A$1:$C$4" , "SomeSheetName!A1:B100", "Sheet1!$A$1:$B$5;Sheet1!$D$1:$D$5".
        Throws:
        com.aspose.ms.System.ArgumentNullException - formula is null.
        com.aspose.ms.System.ArgumentException - formula has incorrect format.
      • setExternalWorkbook

        public final void setExternalWorkbook(java.lang.String workbookPath)

        Sets external workbook as a data source for the chart. Chart data will be updated from the target workbook.


         
         Presentation pres = new Presentation();
         try
         {
            IChart chart = pres.getSlides().get_Item(0).getShapes().addChart(ChartType.Pie, 50, 50, 400, 600, true);
            IChartData chartData = chart.getChartData();
            ((ChartData)chartData).setExternalWorkbook("../../workbook.xlsx");
         } finally {
            if (pres != null) pres.dispose();
         }
          
        Specified by:
        setExternalWorkbook in interface IChartData
        Parameters:
        workbookPath - Path to the target workbook
        Throws:
        com.aspose.ms.System.InvalidOperationException - External workbook is not available or can't be loaded.
      • setExternalWorkbook

        public final void setExternalWorkbook(java.lang.String workbookPath,
                                              boolean updateChartData)

        Sets external workbook as a data source for the chart.


         
         Presentation pres = new Presentation();
         try
         {
             IChart chart = pres.getSlides().get_Item(0).getShapes().addChart(ChartType.Pie, 50, 50, 400, 600, true);
             IChartData chartData = chart.getChartData();
             ((ChartData).setExternalWorkbook("http://path/doesnt/exists", false);
         } finally {
             if (pres != null) pres.dispose();
         }
         
        Specified by:
        setExternalWorkbook in interface IChartData
        Parameters:
        workbookPath - Path to the target workbook
        updateChartData - If value is false only workbook path will be updated. Chart data won't be loaded and updated from the target workbook. Can be used when target workbook doesn't exist or it's not available. If value is true chart data will be updated from the target workbook.
        Throws:
        com.aspose.ms.System.InvalidOperationException - External workbook is not available or can't be loaded.
      • getParent_Immediate

        public final com.aspose.slides.IDOMObject getParent_Immediate()

        Returns Parent_Immediate object. Read-only IDOMObject.

      • switchRowColumn

        public final void switchRowColumn()

        Swap the data over the axis. Data being charted on the X axis will move to the Y axis and vice versa.

        Specified by:
        switchRowColumn in interface IChartData