SetObjectProperty
Syntax
SetObjectProperty(
name: string,
index: number,
value: any,
isStatic: boolean = false
): booleanParameters
Return Value
Description
Example
Last updated
SetObjectProperty(
name: string,
index: number,
value: any,
isStatic: boolean = false
): booleanLast updated
// Set object coordinates
const success1 = this.api.SetObjectProperty(
"MyTrendLine",
ObjProp.OBJPROP_TIME1,
this.api.createFTODate(1641024000000)
);
const success2 = this.api.SetObjectProperty(
"MyTrendLine",
ObjProp.OBJPROP_PRICE1,
1.2
);
// Set visual properties
this.api.SetObjectProperty("MyTrendLine", ObjProp.OBJPROP_COLOR, 0xff0000); // Red color
this.api.SetObjectProperty("MyTrendLine", ObjProp.OBJPROP_STYLE, 1); // Solid line
this.api.SetObjectProperty("MyTrendLine", ObjProp.OBJPROP_WIDTH, 2); // Line width
// Set text properties
this.api.SetObjectProperty("MyLabel", ObjProp.OBJPROP_TEXT, "New Label Text");
this.api.SetObjectProperty("MyLabel", ObjProp.OBJPROP_FONTSIZE, 12);
// Set text alignment (TextAnnotatedPaintTool)
this.api.SetObjectProperty("MyLabel", ObjProp.OBJPROP_VALIGNMENT, TextVAlignment.vaCenter);
this.api.SetObjectProperty("MyLabel", ObjProp.OBJPROP_HALIGNMENT, TextHAlignment.haCenter);
// Set object state
this.api.SetObjectProperty("MyTrendLine", ObjProp.OBJPROP_HIDDEN, true);