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

Specifies all the series captions from data encoded in a separator-delimited string.

Visual Basic
Public Sub SetSeriesCaptionsFromString( captions As String )
C#
public void SetSeriesCaptionsFromString( string captions );

Arguments

captions
A string that specifies the series captions (see SetSeparators).

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.

You can set the series captions in a chart with captions encoded in a string (i.e. the captions argument). The string must be formatted as a list of captions, two consecutive captions must be separated by a separator character that can be specified with the SetSeparators method.

Here is an example of series captions encoded in a string with the character ";" as separator.

myEncodedString= "Year 2006;Year 2007"

The string argument captions is parsed by the chart object according to the separator characters specified to the chart object (see the SetSeparators method for specifying separator characters and rules).

The ";" character is the default separator character.


Sample Code

The following code shows how to specify the series captions corresponding to the table below using the SetSeriesCaptionsFromString 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
' Let's build the series and categories string with ";" as separator
Dim sep As String = ";"
Dim ignore_mult_separators As Boolean = True

' Before setting the series and categories, we must specify the separators
chart.SetSeparators( sep, ignore_mult_separators )

Dim myString As String = "North America" + sep + "South America" + sep + "Europe" + sep + "Middle East" + sep + "Asia"

' Fill the chart with the categories stored in the myString variable
chart.SetCategoriesFromString( myString )

' Add the first series "Year 2006"
myString= "12" + sep + "7.5" + sep + "11.3" + sep + "9.2" + sep + "5.3"

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

' Add the second series "Year 2007"
myString= "14" + sep + "9.9" + sep + "13.1" + sep + "11.5" + sep + "4.9"

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

' Specify the 2 series captions
myString= "Year 2006" + sep + "Year 2007"

' Set the series captions with the strings stored in the myString variable
chart.SetSeriesCaptionsFromString( myString )
C#
// Let's build the series and categories string with ";" as separator
string sep= ";";
bool ignore_mult_separators= true;

// Before setting the series and categories, we must specify the separators
chart.SetSeparators( sep, ignore_mult_separators );

string myString= "North America" + sep + "South America" + sep + "Europe" + sep + "Middle East" + sep + "Asia";

// Fill the chart with the categories stored in the myString variable
chart.SetCategoriesFromString( myString );

// Add the first series "Year 2006"
myString= "12" + sep + "7.5" + sep + "11.3" + sep + "9.2" + sep + "5.3";

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

// Add the second series "Year 2007"
myString= "14" + sep + "9.9" + sep + "13.1" + sep + "11.5" + sep + "4.9";

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

// Specify the 2 series captions
myString= "Year 2006" + sep + "Year 2007";

// Set the series captions with the strings stored in the myString variable
chart.SetSeriesCaptionsFromString( myString );

See Also

SetSeriesCaptionsFromArray Method | GetSeriesCaption Method | GetSeriesValue Method | SeriesCount Property

Applies To: Chart Object