Retrieves the name of a category from its index.
String object.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.
Call the GetValuesCount 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 JSP code enumerates the categories stored in a chart object and displays them.
// Fill the chart object with data and categories stored in the query string chart.SetDataFromTxtFile("C:\\myData.txt"); // Retrieve the number of categories stored in the chart object int n_categories= chart.GetValuesCount(); if( n_categories == 0 ) { out.println( "No category available<br>" ); } else { // Enumerate the categories stored in the chart object for( int i= 0; i < n_categories; ++i ) out.println( "Category[" + i + "]=" + chart.GetCategory(i) + "<br>" ); }
GetValuesCount Method | SetCategoriesFromArray Method | SetCategoriesFromString Method
Applies To: Chart Object