com.aspose.cells

Class SeriesCollection

  • All Implemented Interfaces:
    java.lang.Iterable
    public class SeriesCollection 
    extends CollectionBase

Encapsulates a collection of Series objects.

Example:

//Instantiating a Workbook object
Workbook workbook = new Workbook();
//Adding a new worksheet to the Excel object
int sheetIndex = workbook.getWorksheets().add();
//Obtaining the reference of the newly added worksheet by passing its sheet index
Worksheet worksheet = workbook.getWorksheets().get(sheetIndex);
//Adding a sample value to "A1" cell
worksheet.getCells().get("A1").putValue(50);
//Adding a sample value to "A2" cell
worksheet.getCells().get("A2").putValue(100);
//Adding a sample value to "A3" cell
worksheet.getCells().get("A3").putValue(150);
//Adding a sample value to "A4" cell
worksheet.getCells().get("A4").putValue(200);
//Adding a sample value to "B1" cell
worksheet.getCells().get("B1").putValue(60);
//Adding a sample value to "B2" cell
worksheet.getCells().get("B2").putValue(32);
//Adding a sample value to "B3" cell
worksheet.getCells().get("B3").putValue(50);
//Adding a sample value to "B4" cell
worksheet.getCells().get("B4").putValue(40);
//Adding a sample value to "C1" cell as category data
worksheet.getCells().get("C1").putValue("Q1");
//Adding a sample value to "C2" cell as category data
worksheet.getCells().get("C2").putValue("Q2");
//Adding a sample value to "C3" cell as category data
worksheet.getCells().get("C3").putValue("Y1");
//Adding a sample value to "C4" cell as category data
worksheet.getCells().get("C4").putValue("Y2");
//Adding a chart to the worksheet
int chartIndex = worksheet.getCharts().add(ChartType.COLUMN, 5, 0, 15, 5);
//Accessing the instance of the newly added chart
Chart chart = worksheet.getCharts().get(chartIndex);
//Adding NSeries (chart data source) to the chart ranging from "A1" cell to "B4"
chart.getNSeries().add("A1:B4", true);
//Setting the data source for the category data of NSeries
chart.getNSeries().setCategoryData("C1:C4");
//Saving the Excel file
workbook.save("C:\\book1.xls");

Property Getters/Setters Summary
java.lang.StringgetCategoryData()
void
setCategoryData(java.lang.Stringvalue)
           Gets or sets the range of category Axis values. It can be a range of cells (such as, "d1:e10"), or a sequence of values (such as,"{2,6,8,10}").
intgetCount()
booleanisColorVaried()
void
setColorVaried(booleanvalue)
           Represents if the color of points is varied.
java.lang.StringgetSecondCategoryData()
void
setSecondCategoryData(java.lang.Stringvalue)
           Gets or sets the range of second category Axis values. It can be a range of cells (such as, "d1:e10"), or a sequence of values (such as,"{2,6,8,10}"). Only effects when some ASerieses plot on the second axis.
java.lang.StringgetSecondCatergoryData()
void
setSecondCatergoryData(java.lang.Stringvalue)
           Gets or sets the range of second category Axis values. It can be a range of cells (such as, "d1:e10"), or a sequence of values (such as,"{2,6,8,10}"). Only effects when some ASerieses plot on the second axis.
Seriesget(int index)
Gets the Series element at the specified index.
 
Method Summary
intadd(java.lang.Object value)
Reserved for internal use.
intadd(java.lang.String area, boolean isVertical)
Adds the SeriesCollection collection to a chart.
intaddR1C1(java.lang.String area, boolean isVertical)
Adds the SeriesCollection collection to a chart.
voidchangeSeriesOrder(int sourceIndex, int destIndex)
Directly chanages the orders of the two series.
voidclear()
Clears the collection
booleancontains(java.lang.Object value)
Reserved for internal use.
SeriesgetSeriesByOrder(int order)
Gets the Series element by order.
intindexOf(java.lang.Object value)
Reserved for internal use.
java.util.Iteratoriterator()
voidremoveAt(int index)
Remove at a series at the specific index.
 

    • Property Getters/Setters Detail

      • getCategoryData/setCategoryData

        public java.lang.String getCategoryData() / public void setCategoryData(java.lang.String value)
        
        Gets or sets the range of category Axis values. It can be a range of cells (such as, "d1:e10"), or a sequence of values (such as,"{2,6,8,10}").
      • getSecondCatergoryData/setSecondCatergoryData

        public java.lang.String getSecondCatergoryData() / public void setSecondCatergoryData(java.lang.String value)
        
        Gets or sets the range of second category Axis values. It can be a range of cells (such as, "d1:e10"), or a sequence of values (such as,"{2,6,8,10}"). Only effects when some ASerieses plot on the second axis. NOTE: This member is now obsolete. Instead, please use SeriesCollection.SecondCategoryData property. This property will be removed 12 months later since February 2014. Aspose apologizes for any inconvenience you may have experienced.
      • getSecondCategoryData/setSecondCategoryData

        public java.lang.String getSecondCategoryData() / public void setSecondCategoryData(java.lang.String value)
        
        Gets or sets the range of second category Axis values. It can be a range of cells (such as, "d1:e10"), or a sequence of values (such as,"{2,6,8,10}"). Only effects when some ASerieses plot on the second axis.
      • isColorVaried/setColorVaried

        public boolean isColorVaried() / public void setColorVaried(boolean value)
        
        Represents if the color of points is varied.
      • getCount

        public int getCount()
        
      • get

        public Series get(int index)
        
        Gets the Series element at the specified index.
        Parameters:
        index - The zero based index of the element.
        Returns:
        The element at the specified index.

    setCategoryData

    public voidsetCategoryData(java.lang.Stringvalue)
    
    Gets or sets the range of category Axis values. It can be a range of cells (such as, "d1:e10"), or a sequence of values (such as,"{2,6,8,10}").

    setSecondCatergoryData

    public voidsetSecondCatergoryData(java.lang.Stringvalue)
    
    Gets or sets the range of second category Axis values. It can be a range of cells (such as, "d1:e10"), or a sequence of values (such as,"{2,6,8,10}"). Only effects when some ASerieses plot on the second axis. NOTE: This member is now obsolete. Instead, please use SeriesCollection.SecondCategoryData property. This property will be removed 12 months later since February 2014. Aspose apologizes for any inconvenience you may have experienced.

    setSecondCategoryData

    public voidsetSecondCategoryData(java.lang.Stringvalue)
    
    Gets or sets the range of second category Axis values. It can be a range of cells (such as, "d1:e10"), or a sequence of values (such as,"{2,6,8,10}"). Only effects when some ASerieses plot on the second axis.

    setColorVaried

    public voidsetColorVaried(booleanvalue)
    
    Represents if the color of points is varied.
    • Method Detail

      • getSeriesByOrder

        public Series getSeriesByOrder(int order)
        Gets the Series element by order.
        Parameters:
        order - The order of series
        Returns:
        The element series
      • removeAt

        public void removeAt(int index)
        Remove at a series at the specific index.
        Parameters:
        index - The index.
      • changeSeriesOrder

        public void changeSeriesOrder(int sourceIndex, int destIndex)
        Directly chanages the orders of the two series.
        Parameters:
        sourceIndex - The current index
        destIndex - The dest index
      • addR1C1

        public int addR1C1(java.lang.String area, boolean isVertical)
        Adds the SeriesCollection collection to a chart.
        If set data on contiguous cells, use colon to seperate them.For example, R[1]C[1]:R[3]C[2].

        If set data on contiguous cells, use comma to seperate them.For example,(R[1]C[1],R[3]C[2]).
        Parameters:
        area - Specifies values from which to plot the data series
        isVertical - Specifies whether to plot the series from a range of cell values by row or by column.
        Returns:
        Return the first index of the added ASeries in the NSeries.
      • add

        public int add(java.lang.String area, boolean isVertical)
        Adds the SeriesCollection collection to a chart.
        If set data on contiguous cells, use colon to seperate them.For example, $C$2:$C$5.

        If set data on non contiguous cells, use comma to seperate them.For example: ($C$2,$D$5).
        Parameters:
        area - Specifies values from which to plot the data series
        isVertical - Specifies whether to plot the series from a range of cell values by row or by column.
        Returns:
        Return the first index of the added ASeries in the NSeries.
      • clear

        public void clear()
        Clears the collection
      • iterator

        public java.util.Iterator iterator()
      • contains

        public boolean contains(java.lang.Object value)
        Reserved for internal use.
      • add

        public int add(java.lang.Object value)
        Reserved for internal use.
      • indexOf

        public int indexOf(java.lang.Object value)
        Reserved for internal use.