Label
UI Object that displays one or several labels. This object is typically used as an overlay for an image.
If no data source is specified, a single label will be drawn in the center of the frame. If a data source is defined it will be used to set the center of one or several labels. The positions must be between 0 and 1 unless min and max are specified.
A number of different types of labels are available:
- labels: this type takes the labels from a comma separated list of strings in the variable text.
- alphabetical: the labels are automatically generated as A, B, C....
- numbered: the labels are automatically generated as 0, 1, 2, 3....
- x_value: the labels are taken from the x-coordinate of the input.
- y_value: the labels are taken from the y-coordinate of the input.
- z_value: the labels are taken from the z-coordinate of the input.
- xy_value: the labels are taken from the x- and y-coordinate of the input.
- value: the labels are taken from the column of the input set by the select_value attribute.
The different labels can be given different colors by specifying a list of colors or a color table for the color attribute.
The text and position of the labels can be controlled using the parameters offset_x and offset_y that shifts the label away from the center. The text can be draw left, right or center-justified by setting the text_anchor parameter. The text size can be set using the size parameter. When the labels show a value, the number of decimals to use are set by the decimals-parameter.
Example Label Objects. Top Left. Labels from the list "X,Y,Z". Top Middle. Labels or type numbered with prefix "(" and postfix ")". Top Right. Labels of type xy_value with prefix and postfix brakets. Bottom. Combination of one cross object and two label objects, the first of which uses a list "Yes,No,Maybe" together with text_anchor at end and an offset from the center. The seonc label object consists of coordinates (xy_value) at an offset.
Example XML definition
<object class="Label" module = "MY_MODULE" source = "MY_OUTPUT" type = "xy_value" size = "12" color = "red, green, blue" x="0" y="0" />
Attributes
Attribute | Description | Default |
---|---|---|
class | must be "Label" | |
title | title of the object | module.source |
x | placement of the object | |
y | placement of the object | |
w | width of the object | 1 |
h | height of the object | 1 |
module | name of the module to be visualized, if any | |
source | name of the output to be visualized, if any | |
type | type of label (labels, alphabetical, numbered, x_value, y_value, z_value, xy_value, value) | "labels" |
select | column to get the data from | 0 |
select_value | column to get the value for label from | select |
text | comma separated list of labels | |
color | color of the Label(s) or list of colors | "yelow" |
size | font size | 12 |
text_anchor | text anchor position (start, middle, end) | "middle" |
offset_x | offset from center to text anchor | 0 |
offset_y | offset from center to text anchor | 0 |
prefix | string to put before label | |
postfix | string to put after label | |
min | minimum value for x and y dimensions | 0 |
max | maximum value for x and y dimensions | 1 |
min_x | minimum value for x dimensions | min |
max_x | maximum value for x dimensions | max |
min_y | minimum value for y dimensions | min |
max_y | maximum value for y dimensions | max |
flip_y_axis | invert coordinate system | no |
Author
Christian Balkenius
Lund University Cognitive Science
christian.balkenius@lucs.lu.se
Files
Label.js