Methods of Object Binding
Graphical objects Text, Label, Bitmap and Bitmap Label (OBJ_TEXT, OBJ_LABEL, OBJ_BITMAP and OBJ_BITMAP_LABEL) can have one of the 9 different ways of coordinate binding defined by the OBJPROP_ANCHOR property.
Object | ID | X/Y | Width/Height | Date/Price | |||
|---|---|---|---|---|---|---|---|
Text | — | — | Yes | — | Yes | Yes | |
Label | Yes | Yes (read only) | — | Yes | Yes | Yes | |
Button | Yes | Yes | — | Yes | — | — | |
Bitmap | — | Yes (read only) | Yes | — | Yes | — | |
Bitmap Label | Yes | Yes (read only) | — | Yes | Yes | — | |
Edit | Yes | Yes | — | Yes | — | — | |
Rectangle Label | Yes | Yes | — | Yes | — | — |
The following designations are used in the table:
- X/Y – coordinates of anchor points specified in pixels relative to a chart corner;
- Width/Height – objects have width and height. For "read only", the width and height values are calculated only once the object is rendered on chart;
- Date/Price – anchor point coordinates are specified using the date and price values;
- OBJPROP_CORNER – defines the chart corner relative to which the anchor point coordinates are specified. Can be one of the 4 values of the ENUM_BASE_CORNER enumeration;
- OBJPROP_ANCHOR – defines the anchor point in object itself and can be one of the 9 values of the ENUM_ANCHOR_POINT enumeration. Coordinates in pixels are specified from this very point to selected chart corner;
- OBJPROP_ANGLE – defines the object rotation angle counterclockwise.
The necessary variant can be specified using the function ObjectSetInteger(chart_handle, object_name, OBJPROP_ANCHOR, anchor_point_mode), where anchor_point_mode is one of the values of ENUM_ANCHOR_POINT.
ID | Description |
|---|---|
ANCHOR_LEFT_UPPER | Anchor point at the upper left corner |
ANCHOR_LEFT | Anchor point to the left in the center |
ANCHOR_LEFT_LOWER | Anchor point at the lower left corner |
ANCHOR_LOWER | Anchor point below in the center |
ANCHOR_RIGHT_LOWER | Anchor point at the lower right corner |
ANCHOR_RIGHT | Anchor point to the right in the center |
ANCHOR_RIGHT_UPPER | Anchor point at the upper right corner |
ANCHOR_UPPER | Anchor point above in the center |
ANCHOR_CENTER | Anchor point strictly in the center of the object |
The OBJ_BUTTON, OBJ_RECTANGLE_LABEL, OBJ_EDIT and OBJ_CHART objects have a fixed anchor point in the upper left corner (ANCHOR_LEFT_UPPER).
Example:
string text_name="my_OBJ_TEXT_object"; |
Graphical objects Arrow (OBJ_ARROW) have only 2 ways of linking their coordinates. Identifiers are listed in ENUM_ARROW_ANCHOR.
ID | Description |
|---|---|
ANCHOR_TOP | Anchor on the top side |
ANCHOR_BOTTOM | Anchor on the bottom side |
Example:
void OnStart() |
After the script execution the chart will look like in this figure.
