Namespace: GlobFX.SwiffChartGenerator
Assembly: GlobFX.SwiffChartGenerator (in GlobFX.SwiffChartGenerator.dll)
Retrieves the name of a category from its index.
Public Function GetCategory( index As Integer ) As String
public string GetCategory( int index );
The GetCategory method returns a string value that contains the name of the category specified by index.
If the index argument refers to a category that does not exist in the chart object, the GetCategory method raises an out of bounds error.
Use the ValuesCount property to retrieve the number of categories in the chart object.
The GetCategory method can return an empty string. This happens when the chart object contains series that have a greater number of values than the number of specified categories.
The following code enumerates the categories stored in a chart object and displays them.
' Fill the chart object with data and categories stored in a text file chart.SetDataFromTxtFile("C:\\myData.txt") ' Retrieve the number of categories stored in the chart object Dim n_categories As Integer = chart.ValuesCount If n_categories = 0 Then Me.Response.Write( "No category available<br>" ) Else ' Enumerate the categories stored in the chart object For i As Integer = 0 To n_categories - 1 Me.Response.Write( "Category[" + i + "]=" + chart.GetCategory(i) + "<br>" ) Next End If
// Fill the chart object with data and categories stored in a text file chart.SetDataFromTxtFile("C:\\myData.txt"); // Retrieve the number of categories stored in the chart object int n_categories= chart.ValuesCount; if( n_categories == 0 ) { this.Response.Write( "No category available<br>" ); } else { // Enumerate the categories stored in the chart object for( int i= 0; i < n_categories; ++i ) this.Response.Write( "Category[" + i + "]=" + chart.GetCategory(i) + "<br>" ); }
ValuesCount Property | SetCategoriesFromArray Method | SetCategoriesFromString Method
Applies To: Chart Object