aspose.cells

Class ChartPointCollection

Represents a collection that contains all the points in one series.

Example:

//Instantiating a Workbook object
 $workbook = new cells\Workbook();
 
 //Obtaining the reference of the first worksheet
 $worksheet = $workbook->getWorksheets()->get(0);
 
 //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 "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 chart to the worksheet
 $chartIndex = $worksheet->getCharts()->add(cells\ChartType::PIE_EXPLODED, 5, 0, 25, 10);
 //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 "B3"
 $chart->getNSeries()->add("A1:B3", true);
 //Show Data Labels 
 $chart->getNSeries()->get(0)->getDataLabels()->setShowValue(true);
 $points = $chart->getNSeries()->get(0)->getPoints();
 for ($i = 0; $i < java_values($points->getCount()); $i++)
 {
     //Get Data Point
     $point = $points->get($i);
     //Set Pir Explosion
     $point->setExplosion(15);
     //Set Border Color
     $point->getBorder()->setColor(cells\Color::getRed());
 }

Property Getters/Setters Summary
functiongetCount()
Gets the count of the chart point.
functionget(index)
Gets the ChartPoint element at the specified index in the series.
 
Method Summary
functionclear()
Remove all setting of the chart points.
functioniterator()
Returns an enumerator for the entire ChartPointCollection.
functionremoveAt(index)
Removes point at the index of the series..
 

    • Property Getters/Setters Detail

      • getCount : Number 

        function getCount()
        
        Gets the count of the chart point.
      • get : ChartPoint 

        function get(index)
        
        Gets the ChartPoint element at the specified index in the series.
        Parameters:
        index - The index of chart point in the series.
        Returns:
        The ChartPoint object.
    • Method Detail

      • iterator

        function iterator()
        Returns an enumerator for the entire ChartPointCollection.
        Returns:
      • clear

        function clear()
        Remove all setting of the chart points.
      • removeAt

        function removeAt(index)
        Removes point at the index of the series..
        Parameters:
        index: Number - The index of the point.