Annotation
public struct Annotation : Encodable
Undocumented
-
Determines whether or not this annotation is visible.
Declaration
Swift
public var visible: Bool?
-
Sets the annotation’s x position.
Declaration
Swift
public var x: Anything?
-
Sets the annotation’s y position.
Declaration
Swift
public var y: Anything?
-
Sets the annotation’s z position.
Declaration
Swift
public var z: Anything?
-
Sets the x component of the arrow tail about the arrow head (in pixels).
Declaration
Swift
public var ax: Double?
-
Sets the y component of the arrow tail about the arrow head (in pixels).
Declaration
Swift
public var ay: Double?
-
Sets the text box’s horizontal position anchor This anchor binds the
x
position to the left, center or right of the annotation.For example, if
x
is set to 1,xref
to paper andxanchor
to right then the right-most portion of the annotation lines up with the right-most edge of the plotting area. If auto, the anchor is equivalent to center for data-referenced annotations or if there is an arrow, whereas for paper-referenced with no arrow, the anchor picked corresponds to the closest side.Declaration
Swift
public var xAnchor: XAutoAnchor?
-
Shifts the position of the whole annotation and arrow to the right (positive) or left (negative) by this many pixels.
Declaration
Swift
public var xShift: Double?
-
Sets the text box’s vertical position anchor This anchor binds the
y
position to the top, middle or bottom of the annotation.For example, if
y
is set to 1,yref
to paper andyanchor
to top then the top-most portion of the annotation lines up with the top-most edge of the plotting area. If auto, the anchor is equivalent to middle for data-referenced annotations or if there is an arrow, whereas for paper-referenced with no arrow, the anchor picked corresponds to the closest side.Declaration
Swift
public var yAnchor: YAutoAnchor?
-
Shifts the position of the whole annotation and arrow up (positive) or down (negative) by this many pixels.
Declaration
Swift
public var yShift: Double?
-
Sets the annotation text font.
Declaration
Swift
public var font: Font?
-
Sets an explicit width for the text box.
null (default) lets the text set the box width. Wider text will be clipped. There is no automatic wrapping; use
to start a new line.Declaration
Swift
public var width: Double?
-
Sets an explicit height for the text box.
null (default) lets the text set the box height. Taller text will be clipped.
Declaration
Swift
public var height: Double?
-
Sets the opacity of the annotation (text + arrow).
Declaration
Swift
public var opacity: Double?
-
Sets the horizontal alignment of the
text
within the box.Has an effect only if
text
spans two or more lines (i.e.text
contains one or more
HTML tags) or if an explicit width is set to override the text width.Declaration
Swift
public var align: HorizontalAlign?
-
Sets the vertical alignment of the
text
within the box.Has an effect only if an explicit height is set to override the text height.
Declaration
Swift
public var verticalAlign: VerticalAlign?
-
Sets the background color of the annotation.
Declaration
Swift
public var backgroundColor: Color?
-
Sets the padding (in px) between the
text
and the enclosing border.Declaration
Swift
public var borderPadding: Double?
-
Sets the width (in px) of the border enclosing the annotation
text
.Declaration
Swift
public var borderWidth: Double?
-
Sets the color of the annotation arrow.
Declaration
Swift
public var arrowColor: Color?
-
Sets the end annotation arrow head style.
Declaration
Swift
public var arrowHead: Int?
-
Sets the start annotation arrow head style.
Declaration
Swift
public var startArrowHead: Int?
-
Sets the annotation arrow head position.
See moreDeclaration
Swift
public struct ArrowSide : OptionSet, Encodable
-
Sets the annotation arrow head position.
Declaration
Swift
public var arrowSide: ArrowSide?
-
Sets the size of the end annotation arrow head, relative to
arrowwidth
.A value of 1 (default) gives a head about 3x as wide as the line.
Declaration
Swift
public var arrowSize: Double?
-
Sets the size of the start annotation arrow head, relative to
arrowwidth
.A value of 1 (default) gives a head about 3x as wide as the line.
Declaration
Swift
public var startArrowSize: Double?
-
Sets the width (in px) of annotation arrow line.
Declaration
Swift
public var arrowWidth: Double?
-
Sets a distance, in pixels, to move the end arrowhead away from the position it is pointing at, for example to point at the edge of a marker independent of zoom.
Note that this shortens the arrow from the
ax
/ay
vector, in contrast toxshift
/yshift
which moves everything by this amount.Declaration
Swift
public var standoff: Double?
-
Sets a distance, in pixels, to move the start arrowhead away from the position it is pointing at, for example to point at the edge of a marker independent of zoom.
Note that this shortens the arrow from the
ax
/ay
vector, in contrast toxshift
/yshift
which moves everything by this amount.Declaration
Swift
public var startStandoff: Double?
-
Sets text to appear when hovering over this annotation.
If omitted or blank, no hover label will appear.
Declaration
Swift
public var hoverText: String?
-
Undocumented
See moreDeclaration
Swift
public struct HoverLabel : Encodable
-
Undocumented
Declaration
Swift
public var hoverLabel: HoverLabel?
-
Determines whether the annotation text box captures mouse move and click events, or allows those events to pass through to data points in the plot that may be behind the annotation.
By default
captureevents
is false unlesshovertext
is provided. If you use the eventplotly_clickannotation
withouthovertext
you must explicitly enablecaptureevents
.Declaration
Swift
public var captureEvents: Bool?
-
When used in a template, named items are created in the output figure in addition to any items the figure already has in this array.
You can modify these items in the output figure by making your own item with
templateitemname
matching thisname
alongside your modifications (includingvisible: false
orenabled: false
to hide it). Has no effect outside of a template.Declaration
Swift
public var name: String?
-
Used to refer to a named item in this array in the template.
Named items from the template will be created even without a matching item in the input figure, but you can modify one by making an item with
templateitemname
matching itsname
, alongside your modifications (includingvisible: false
orenabled: false
to hide it). If there is no template or no matching item, this item will be hidden unless you explicitly show it withvisible: true
.Declaration
Swift
public var templateItemName: String?
-
init(visible:
x: y: z: ax: ay: xAnchor: xShift: yAnchor: yShift: text: textAngle: font: width: height: opacity: align: verticalAlign: backgroundColor: borderColor: borderPadding: borderWidth: showArrow: arrowColor: arrowHead: startArrowHead: arrowSide: arrowSize: startArrowSize: arrowWidth: standoff: startStandoff: hoverText: hoverLabel: captureEvents: name: templateItemName: ) Creates
Annotation
object with specified properties.Declaration
Swift
public init(visible: Bool? = nil, x: Anything? = nil, y: Anything? = nil, z: Anything? = nil, ax: Double? = nil, ay: Double? = nil, xAnchor: XAutoAnchor? = nil, xShift: Double? = nil, yAnchor: YAutoAnchor? = nil, yShift: Double? = nil, text: String? = nil, textAngle: Angle? = nil, font: Font? = nil, width: Double? = nil, height: Double? = nil, opacity: Double? = nil, align: HorizontalAlign? = nil, verticalAlign: VerticalAlign? = nil, backgroundColor: Color? = nil, borderColor: Color? = nil, borderPadding: Double? = nil, borderWidth: Double? = nil, showArrow: Bool? = nil, arrowColor: Color? = nil, arrowHead: Int? = nil, startArrowHead: Int? = nil, arrowSide: ArrowSide? = nil, arrowSize: Double? = nil, startArrowSize: Double? = nil, arrowWidth: Double? = nil, standoff: Double? = nil, startStandoff: Double? = nil, hoverText: String? = nil, hoverLabel: HoverLabel? = nil, captureEvents: Bool? = nil, name: String? = nil, templateItemName: String? = nil)
Parameters
visible
Determines whether or not this annotation is visible.
x
Sets the annotation’s x position.
y
Sets the annotation’s y position.
z
Sets the annotation’s z position.
ax
Sets the x component of the arrow tail about the arrow head (in pixels).
ay
Sets the y component of the arrow tail about the arrow head (in pixels).
xAnchor
Sets the text box’s horizontal position anchor This anchor binds the
x
position to the left, center or right of the annotation.xShift
Shifts the position of the whole annotation and arrow to the right (positive) or left (negative) by this many pixels.
yAnchor
Sets the text box’s vertical position anchor This anchor binds the
y
position to the top, middle or bottom of the annotation.yShift
Shifts the position of the whole annotation and arrow up (positive) or down (negative) by this many pixels.
text
Sets the text associated with this annotation.
textAngle
Sets the angle at which the
text
is drawn with respect to the horizontal.font
Sets the annotation text font.
width
Sets an explicit width for the text box.
height
Sets an explicit height for the text box.
opacity
Sets the opacity of the annotation (text + arrow).
align
Sets the horizontal alignment of the
text
within the box.verticalAlign
Sets the vertical alignment of the
text
within the box.backgroundColor
Sets the background color of the annotation.
borderColor
Sets the color of the border enclosing the annotation
text
.borderPadding
Sets the padding (in px) between the
text
and the enclosing border.borderWidth
Sets the width (in px) of the border enclosing the annotation
text
.showArrow
Determines whether or not the annotation is drawn with an arrow.
arrowColor
Sets the color of the annotation arrow.
arrowHead
Sets the end annotation arrow head style.
startArrowHead
Sets the start annotation arrow head style.
arrowSide
Sets the annotation arrow head position.
arrowSize
Sets the size of the end annotation arrow head, relative to
arrowwidth
.startArrowSize
Sets the size of the start annotation arrow head, relative to
arrowwidth
.arrowWidth
Sets the width (in px) of annotation arrow line.
standoff
Sets a distance, in pixels, to move the end arrowhead away from the position it is pointing at, for example to point at the edge of a marker independent of zoom.
startStandoff
Sets a distance, in pixels, to move the start arrowhead away from the position it is pointing at, for example to point at the edge of a marker independent of zoom.
hoverText
Sets text to appear when hovering over this annotation.
hoverLabel
captureEvents
Determines whether the annotation text box captures mouse move and click events, or allows those events to pass through to data points in the plot that may be behind the annotation.
name
When used in a template, named items are created in the output figure in addition to any items the figure already has in this array.
templateItemName
Used to refer to a named item in this array in the template.