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

Set categories names from data stored in a single-dimension array.

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

Arguments

categories
A single-dimension array containing the categories names as elements.

Sample Code

The following code shows how to store the series and categories of the table below using the SetCategoriesFromArray method. This table has two series named "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 myArray2(4) As Double

myArray2(0) = 12.0
myArray2(1) = 7.5
myArray2(2) = 11.3
myArray2(3) = 9.2
myArray2(4) = 5.3

' Fill the first series with the data stored in the myArray2 variable
chart.SetSeriesCaption(0, "Year 2006")
chart.SetSeriesValuesFromArray(0, myArray2)

' Do the same way for the second series "Year 2007"
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[] myArray2= new double[5];
myArray2[0]= 12.0;
myArray2[1]= 7.5;
myArray2[2]= 11.3;
myArray2[3]= 9.2;
myArray2[4]= 5.3;

// Fill the first series with the data stored in the myArray2 variable
chart.SetSeriesCaption(0, "Year 2006");
chart.SetSeriesValuesFromArray(0, myArray2);

// Do the same way for the second series "Year 2007"

See Also

SetCategoriesFromString Method | GetCategory Method

Applies To: Chart Object