GetObjectCount

Returns the total number of chart objects.

Syntax

GetObjectCount(isStatic: boolean = false): number

Parameters

Parameter
Type
Description

isStatic

boolean

Optional. Whether to count static objects (default: false)

Return Value

Returns a number representing the total count of chart objects.

Description

The GetObjectCount method returns the total number of objects in the chart. It can count either regular objects or static objects, depending on the isStatic parameter.

Example

// Get count of regular objects
const regularCount = this.api.GetObjectCount();
console.log(`Regular objects: ${regularCount}`);

// Get count of static objects
const staticCount = this.api.GetObjectCount(true);
console.log(`Static objects: ${staticCount}`);

// Use counts in a loop
for (let i = 0; i < this.api.GetObjectCount(); i++) {
  const objectName = this.api.GetObjectName(i);
  console.log(`Object ${i}: ${objectName}`);
}

Last updated