documentationfor yFiles for HTML 3.0.0.2

IconLabelStyle

A label style that wraps another ILabelStyle and draws an icon in addition to the text.

Inheritance Hierarchy
IconLabelStyle
Implemented Interfaces

Remarks

This style draws the icon at the location specified by iconPlacement and delegates the drawing of the label's text and background to the wrappedStyle style.

Note that in addition to the href the iconSize has to be set, otherwise the icon cannot be rendered.

Examples

const labelStyle = new IconLabelStyle({
  href: 'icon.svg',
  iconSize: [16, 16],
  iconPlacement: InteriorNodeLabelModel.LEFT,
  wrappedStyle: new LabelStyle({
    backgroundFill: Color.LIGHT_GRAY,
    backgroundStroke: Stroke.BLACK,
  }),
})
graph.addLabel(
  node,
  'Label Text',
  ExteriorNodeLabelModel.BOTTOM,
  labelStyle,
)

Type Details

yFiles module
view

See Also

The iconSize must be set to a non-EMPTY value, otherwise the href will not be rendered.

Constructors

Properties

Methods