aspose.cells

Class SeriesCollection

Encapsulates a collection of Series objects.

Example:

//Instantiating a Workbook object
$workbook = new cells\Workbook();
//Adding a new worksheet to the Excel object
$sheetIndex = $workbook->getWorksheets()->add();
//Obtaining the reference of the newly added worksheet by passing its sheet index
$worksheet = $workbook->getWorksheets()->get($sheetIndex);
$cells = $worksheet->getCells();
$cells->get("A1")->putValue(50);
$cells->get("A2")->putValue(100);
$cells->get("A3")->putValue(150);
$cells->get("A4")->putValue(200);
$cells->get("B1")->putValue(60);
$cells->get("B2")->putValue(32);
$cells->get("B3")->putValue(50);
$cells->get("B4")->putValue(40);
$cells->get("C1")->putValue("Q1");
$cells->get("C2")->putValue("Q2");
$cells->get("C3")->putValue("Y1");
$cells->get("C4")->putValue("Y2");
//Adding a chart to the worksheet
$chartIndex = $worksheet->getCharts()->add(cells\ChartType::COLUMN, 5, 0, 15, 5);
//Accessing the instance of the newly added 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");

Property Getters/Setters Summary
functiongetCategoryData()
function
           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}").
functiongetCount()
functionisColorVaried()
function
           Represents if the color of points is varied.
functiongetSecondCategoryData()
function
           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.
functionget(index)
Gets the Series element at the specified index.
 
Method Summary
functionadd(value)
Reserved for internal use.
functionadd(area, isVertical)
Adds the Series collection to a chart.
functionadd(area, isVertical, checkLabels)
Adds the Series collection to a chart.
functionaddR1C1(area, isVertical)
Adds the Series collection to a chart.
functionchangeSeriesOrder(sourceIndex, destIndex)
Directly changes the orders of the two series.
functionclear()
Clears the collection
functioncontains(value)
Reserved for internal use.
functionget(index)
Reserved for internal use.
functiongetSeriesByOrder(order)
Gets the Series element by order.
functionindexOf(value)
Reserved for internal use.
functioniterator()
functionremoveAt(index)
Remove at a series at the specific index.
functionsetSeriesNames(startIndex, area, isVertical)
Sets the name of all the serieses in the chart.
 

    • Property Getters/Setters Detail

      • getCategoryData/setCategoryData : String 

        function getCategoryData() / function setCategoryData(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}").
      • getSecondCategoryData/setSecondCategoryData : String 

        function getSecondCategoryData() / function setSecondCategoryData(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 : boolean 

        function isColorVaried() / function setColorVaried(value)
        
        Represents if the color of points is varied.
      • getCount : Number 

        function getCount()
        
      • get : Series 

        function get(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.
    • Method Detail

      • getSeriesByOrder

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

        function removeAt(index)
        Remove at a series at the specific index.
        Parameters:
        index: Number - The index.
      • changeSeriesOrder

        function changeSeriesOrder(sourceIndex, destIndex)
        Directly changes the orders of the two series.
        Parameters:
        sourceIndex: Number - The current index
        destIndex: Number - The dest index
      • setSeriesNames

        function setSeriesNames(startIndex, area, isVertical)
        Sets the name of all the serieses in the chart.
        If the start index is larger than the count of the serieses, it will return and do nothing.

        If set data on contiguous cells, use colon to seperate them.For example, $C$2:$C$5.

        If set data on contiguous cells, use comma to seperate them.For example, ($C$2,$D$5).
        Parameters:
        startIndex: Number - The index of the first series which you want to set the name.
        area: String - Specifies the area for the series name.
        isVertical: boolean - >Specifies whether to plot the series from a range of cell values by row or by column.
      • addR1C1

        function addR1C1(area, isVertical)
        Adds the Series 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: String - Specifies values from which to plot the data series
        isVertical: boolean - 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

        function add(area, isVertical)
        Adds the Series 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: String - Specifies values from which to plot the data series
        isVertical: boolean - 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

        function add(area, isVertical, checkLabels)
        Adds the Series 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: String - Specifies values from which to plot the data series
        isVertical: boolean - Specifies whether to plot the series from a range of cell values by row or by column.
        checkLabels: boolean - Indicates whether the range contains series's name
        Returns:
        Return the first index of the added ASeries in the NSeries.
      • clear

        function clear()
        Clears the collection
      • iterator

        function iterator()
      • get

        function get(index)
        Reserved for internal use.
      • contains

        function contains(value)
        Reserved for internal use.
      • add

        function add(value)
        Reserved for internal use.
      • indexOf

        function indexOf(value)
        Reserved for internal use.