RemoveChartObject
Syntax
RemoveChartObject(uniqueObjectName: string, isStatic: boolean = false): voidParameters
Description
Example
// Remove a regular chart object
this.api.RemoveChartObject("MyTrendLine");
// Remove a static chart object
this.api.RemoveChartObject("MyStaticLabel", true);
// Remove object after checking existence
if (this.api.DoesChartObjectExist("MyObject")) {
this.api.RemoveChartObject("MyObject");
console.log("Object removed successfully");
}
// Remove multiple related objects
const objectPrefix = "Signal_";
for (let i = 0; i < this.api.GetObjectCount(); i++) {
const name = this.api.GetObjectName(i);
if (name.startsWith(objectPrefix)) {
this.api.RemoveChartObject(name);
}
}Last updated