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

Specifies all the series captions from strings stored in a single-dimension array.

Visual Basic
Public Sub SetSeriesCaptionsFromArray( captions As String() )
C#
public void SetSeriesCaptionsFromArray( string[] captions );

Arguments

captions
A single-dimension array containing the series captions as elements.

Remarks

By default, a new data series added to a chart has no caption.

If some series do not exist, they are created only if the corresponding caption is not empty.

The data stored in the array must be string values.


Sample Code

The following 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 2006" and "Year 2007". The categories are "North America", "South America", "Europe", "Middle East" and "Asia".

  North America South America Europe Middle East Asia
Year 2006 12 7.5 11.3 9.2 5.3
Year 2007 14 9.9 13.1 11.5 4.9

Visual Basic
Dim myArray(4) As String
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 2006"
Dim myValues(4) As Double
myValues(0) = 12.0
myValues(1) = 7.5
myValues(2) = 11.3
myValues(3) = 9.2
myValues(4) = 5.3

' Fill the first series with the data stored in the myValues variable
chart.SetSeriesValuesFromArray(0, myValues)

' Add the second series "Year 2007"
myValues(0) = 14.0
myValues(1) = 9.9
myValues(2) = 13.1
myValues(3) = 11.5
myValues(4) = 4.9

' Fill the second series with the data stored in the myValues variable
chart.SetSeriesValuesFromArray(1, myValues)

' Specify the 2 series captions
Dim myCaptions(1) As String
myCaptions(0) = "Year 2006"
myCaptions(1) = "Year 2007"

' Set the series captions with the strings stored in the myCaptions variable
chart.SetSeriesCaptionsFromArray( myCaptions )
C#
string[] myArray= new string[5];
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 2006"
double[] myValues= new double[5];
myValues[0]= 12.0;
myValues[1]= 7.5;
myValues[2]= 11.3;
myValues[3]= 9.2;
myValues[4]= 5.3;

// Fill the first series with the data stored in the myValues variable
chart.SetSeriesValuesFromArray(0, myValues);

// Add the second series "Year 2007"
myValues[0]= 14.0;
myValues[1]= 9.9;
myValues[2]= 13.1;
myValues[3]= 11.5;
myValues[4]= 4.9;

// Fill the second series with the data stored in the myValues variable
chart.SetSeriesValuesFromArray(1, myValues);

// Specify the 2 series captions
string[] myCaptions= new string[2];
myCaptions[0]= "Year 2006";
myCaptions[1]= "Year 2007";

// Set the series captions with the strings stored in the myCaptions variable
chart.SetSeriesCaptionsFromArray( myCaptions );

See Also

SetSeriesCaptionsFromString Method | GetSeriesCaption Method | GetSeriesValue Method | SeriesCount Property

Applies To: Chart Object