The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

yEd::Label - Textlabels for Nodes and Edges

DESCRIPTION

This is the base class for Labels. It may not be instanciated, instead use one of the specialized types:

SUPPORTED FEATURES

Labels are supported for both, Nodes and Edges. However there are some features which are currently not supported:

  • Smart Labels: Because they offer few advantages over the other types and are much more complex to implement.

  • configuration of the Preferred Placement Descriptors: As they seem to only have an effect on Smart Labels (and do only exist for Labels on Edges).

  • SVG content (icons) for Labels

All other types and features of Labels (yEd Version 3.13) are supported.

For the available types (positioning modells) see the documentation of the specialized Labels.

Other than in yEd itself you may add more than one Label to a single Node or Edge, regardless of its type. In fact some special Nodes in yEd have multiple Labels per default (e.g. tables), so yEd will handle this correctly.

PROPERTIES

text

Type: anything

Default: ... must be supplied

The text to be displayed by the Label.

If this is a blessed ref it will try to find a toString or to_string method with the fallback of standard perl stringification.

If this is an array ref each entry will be treated as a line of text.

If this is a hash ref its content will be formated like so:

    key1:        value
    key2:        val2
    another key: val3

visible

Type: bool

Default: true

Whether the Label is visible or not (rather useless).

x

Type: float

Default: 0

The x position of the Label (ignored in most positioning modells).

y

Type: float

Default: 0

The y position of the Label (ignored in most positioning modells).

height

Type: ufloat

Default: 20

The height of the Label (mostly ignored depending on autoSizePolicy).

width

Type: ufloat

Default: 30

The width of the Label (mostly ignored depending on autoSizePolicy).

backgroundColor

Type: '#0000fa' (rgb) or '#000000cc' (rgb + transparency) java.awt.Color hex form or 'none'

Default: 'none'

The background color of the Label.

lineColor

Type: '#0000fa' (rgb) or '#000000cc' (rgb + transparency) java.awt.Color hex form or 'none'

Default: 'none'

The border color of the Label.

bottomInset

Type: uint

Default: 0

The inset between Label border and text.

topInset

Type: uint

Default: 0

The inset between Label border and text.

leftInset

Type: uint

Default: 0

The inset between Label border and text.

rightInset

Type: uint

Default: 0

The inset between Label border and text.

rotationAngle

Type: float

Default: 0

Rotation of the whole Label.

alignment

Type: descrete values ( center | right | left )

Default: 'center'

The text alignment.

fontFamily

Type: Fontstring

Default: 'Dialog'

The font for the Label text.

As fonts differs on systems and platforms, this is not a descrete values property, be sure to choose a proper value (e.g. look into a yEd created graphml). The default font 'Dialog' seems to be always present.

fontSize

Type: uint

Default: 12

The font size.

fontStyle

Type: descrete values ( plain | bold | italic | bolditalic )

Default: 'plain'

The font style.

textColor

Type: '#0000fa' (rgb) or '#000000cc' (rgb + transparency) java.awt.Color hex form or 'none'

Default: '#000000'

The text color.

underlinedText

Type: bool

Default: false

Whether the text is underlined or not.

SUBROUTINES/METHODS

copy

Creates a copy of this Label and returns it.

You may optionally specify properties in the form 'property => value, ...' to change these properties for the returned copy.

getTextString

While the 'text' property will return the set value (which may be a ref), this will return the text form of the property as it will be shown in yEd.

Have a look at the 'text' property description for details.

allInsets

This is an alternative setter for the inset properties.

It takes one or two parameters, where the first one will set bottom and top (or all insets if there is no second parameter) and the second will set left and right.

setProperties getProperties hasProperties

As described at yEd::PropertyBasedObject

SEE ALSO

yEd::Document for further informations about the whole package

yEd::PropertyBasedObject for further basic information about properties and their additional functions

yEd::Label::EdgeLabel for information about specialized Label elements for Edges

yEd::Label::NodeLabel for information about specialized Label elements for Nodes