Retrieves the caption of a data series from its index.

object.GetSeriesCaption( index ) 

Arguments

object
Required. A Chart object.
index
Required. An integer value that specifies the zero-based index of the series in the chart object.

Return Value

The GetSeriesCaption method returns a string value that contains the caption for the series specified by index.

Remarks

If the index argument refers to a series that does not exist in the chart object, the GetSeriesCaption method raises an out of bounds error.

The GetSeriesCaption method can return an empty string. This happens when the chart object contains series values without any corresponding caption.

JScript Sample Code

The following JScript code enumerates the series stored in a chart object and displays their caption in an ASP page.

// Fill the chart object with data and categories stored in the query string 
chart.SetSeparators(";", true);
chart.SetDataFromQuery();

// Retrieve the number of series stored in the chart object 
n_series= chart.GetSeriesCount();

if( n_series == 0 )
  Response.Write("No series available");
else
  {
  // Enumerate the series stored in the chart object 
  for( i= 0; i < n_series; ++i )
    Response.Write(chart.GetSeriesCaption(i) + " is the Caption for series number " + i);
  }

See Also

SetSeriesCaption Method | GetSeriesValue Method | SetSeriesValuesFromString Method | SetSeriesValuesFromArray Method

Applies To: Chart Object