Retrieves the number of series values and categories in the chart object.

object.GetValuesCount( ) 

Arguments

object
Required. A Chart object.

Return Value

An integer value containing the number of values per series. This number is also the number of categories.

JScript Code Sample

The following JScript code illustrates use of the GetValuesCount method in an ASP page.

var values1= new Array(2);
var values2= new Array(3);

values1[0] = 1;
values1[1] = 2;

values2[0] = 10;
values2[1] = 20;
values2[2] = 30;

chart.AddSeries();
chart.SetSeriesValuesFromArray(0, values1);

// count1 is now equal to 2
count1= chart.GetValuesCount();

chart.AddSeries();
chart.SetSeriesValuesFromArray(1, values2);

// count2 is now equal to 3
count2= chart.GetValuesCount();

var categories= new Array(4);

categories[0]= "Cat 1";
categories[1]= "Cat 2";
categories[2]= "Cat 3";
categories[3]= "Cat 4";

chart.SetCategoriesFromArray(categories);

// count3 is now equal to 4
count3= chart.GetValuesCount();

Response.Write("Count 1= " + count1 + "<br>");
Response.Write("Count 2= " + count2 + "<br>");
Response.Write("Count 3= " + count3 + "<br>");

The result displayed in the Web Browser will be:

Count 1= 2
Count 2= 3
Count 3= 4

See Also

SetSeriesValuesFromString Method | SetSeriesValuesFromArray Method | SetCategoriesFromString Method | SetCategoriesFromArray Method | GetSeriesCount Method

Applies To: Chart Object