Specifies all the series captions from strings stored in a single-dimension array.
void object->SetSeriesCaptionsFromArray( array captions )
By default, a new data series added to a chart with the method AddSeries has no caption.
The data stored in the array must be string values.
The following PHP code shows how to specify the series captions corresponding to the table below using the SetSeriesCaptionsFromArray method. This table has two series with captions "Year 2000" and "Year 2001". The categories are "North America", "South America", "Europe", "Middle East" and "Asia".
|
||||||||||||||||||
![]() |
$myArray= array(); $myArray[0]= "North America"; $myArray[1]= "South America"; $myArray[2]= "Europe"; $myArray[3]= "Middle East"; $myArray[4]= "Asia"; //Fill the chart with the categories stored in the myArray variable $chart->SetCategoriesFromArray( $myArray ); //Add the first series "Year 2000" $myArray[0]= 12; $myArray[1]= 7.5; $myArray[2]= 11.3; $myArray[3]= 9.2; $myArray[4]= 5.3; //Fill the first series with the data stored in the myArray variable $chart->AddSeries(); $chart->SetSeriesValuesFromArray(0, $myArray); //Add the second series "Year 2001" $myArray[0]= 14; $myArray[1]= 9.9; $myArray[2]= 13.1; $myArray[3]= 11.5; $myArray[4]= 4.9; //Fill the second series with the data stored in the myArray variable $chart->AddSeries(); $chart->SetSeriesValuesFromArray(1, $myArray); //Specify the 2 series captions $myCaptions= array(2); $myCaptions[0]= "Year 2000"; $myCaptions[1]= "Year 2001"; //Set the series captions with the strings stored in the myCaptions variable $chart->SetSeriesCaptionsFromArray( $myCaptions );
SetSeriesCaptionsFromString Method | GetSeriesCaption Method | GetSeriesValue Method | GetSeriesCount Method
Applies To: Chart Object