Namespace: GlobFX.SwiffChartGenerator
Assembly: GlobFX.SwiffChartGenerator (in GlobFX.SwiffChartGenerator.dll)

Retrieves the caption of a data series from its index.

Visual Basic

    Public Function GetSeriesCaption( index As Integer ) As String

C#

    public string GetSeriesCaption( int index );

#### Arguments

index
  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 invalid series index error.

- index must be superior or equal to 0.

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

#### Sample Code

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

Visual Basic

    ' Fill the chart object with data and categories stored in the query string
    chart.SetDataFromTxtFile("C:\\myData.txt")

    ' Retrieve the number of series stored in the chart object
    Dim n_series As Integer = chart.SeriesCount

    If n_series = 0 Then
      Me.Response.Write("No series available<br>")
    Else
      ' Enumerate the series stored in the chart object
      Dim i As Integer
      For i = 0 To n_series - 1
        Me.Response.Write( chart.GetSeriesCaption(i) + " is the Caption for series number " + i + "<br>" )
      Next
    End If

C#

    // Fill the chart object with data and categories stored in the query string
    chart.SetDataFromTxtFile("C:\\myData.txt");

    // Retrieve the number of series stored in the chart object
    int n_series= chart.SeriesCount;

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

#### See Also

SetSeriesCaption Method | GetSeriesValue Method | SetSeriesValuesFromString Method | SetSeriesValuesFromArray Method

Applies To: Chart Object