Class pv.Label
Extends
pv.Mark.
Represents a text label, allowing textual annotation of other marks or
arbitrary text within the visualization. The character data must be plain
text (unicode), though the text can be styled using the #font
property. If rich text is needed, external HTML elements can be overlaid on
the canvas by hand.
Labels are positioned using the box model, similarly to Dot. Thus, a label has no width or height, but merely a text anchor location. The text is positioned relative to this anchor location based on the #textAlign, #textBaseline and #textMargin properties. Furthermore, the text may be rotated using #textAngle.
Labels ignore events, so as to not interfere with event handlers on underlying marks, such as bars. In the future, we may support event handlers on labels.
See also the Label guide.
Defined in: Label.js.
Constructor Attributes | Constructor Name and Description |
---|---|
pv.Label()
Constructs a new label mark with default properties.
|
Field Attributes | Field Name and Description |
---|---|
Default properties for labels.
|
|
The font format, per the CSS Level 2 specification.
|
|
The character data to render; a string.
|
|
The horizontal text alignment.
|
|
The rotation angle, in radians.
|
|
The vertical text alignment.
|
|
A list of decoration to be applied to text, per the CSS Text Level 3
text-decoration property.
|
|
The text margin; may be specified in pixels, or in font-dependent units (such
as ".1ex").
|
|
A list of shadow effects to be applied to text, per the CSS Text Level 3
text-shadow property.
|
|
The text color.
|
- Fields borrowed from class pv.Mark:
- bottom, childIndex, cursor, data, events, index, left, parent, proto, reverse, right, root, scale, title, top, type, visible
- Methods borrowed from class pv.Mark:
- add, anchor, anchorTarget, def, event, extend, margin, mouse, render
- See:
- CSS2 fonts
- left
- center
- right
- top
- middle
- bottom
- See:
- CSS3 text
- See:
- CSS3 text
- See:
- pv.color