Legend
public struct Legend : Encodable
Undocumented
-
Sets the legend background color.
Defaults to
layout.paper_bgcolor.Declaration
Swift
public var backgroundColor: Color? -
Sets the color of the border enclosing the legend.
Declaration
Swift
public var borderColor: Color? -
Sets the width (in px) of the border enclosing the legend.
Declaration
Swift
public var borderWidth: Double? -
Sets the font used to text the legend items.
Declaration
Swift
public var font: Font? -
Sets the orientation of the legend.
Declaration
Swift
public var orientation: Orientation? -
Determines the order at which the legend items are displayed.
If normal, the items are displayed top-to-bottom in the same order as the input data. If reversed, the items are displayed in the opposite order as normal. If grouped, the items are displayed in groups (when a trace
See morelegendgroupis provided). if grouped+reversed, the items are displayed in the opposite order as grouped.Declaration
Swift
public struct TraceOrder : OptionSet, Encodable -
Determines the order at which the legend items are displayed.
If normal, the items are displayed top-to-bottom in the same order as the input data. If reversed, the items are displayed in the opposite order as normal. If grouped, the items are displayed in groups (when a trace
legendgroupis provided). if grouped+reversed, the items are displayed in the opposite order as grouped.Declaration
Swift
public var traceOrder: TraceOrder? -
Sets the amount of vertical space (in px) between legend groups.
Declaration
Swift
public var traceGroupGap: Double? -
Determines if the legend items symbols scale with their corresponding trace attributes or remain constant independent of the symbol size on the graph.
See moreDeclaration
Swift
public enum ItemSizing : String, Encodable -
Determines if the legend items symbols scale with their corresponding trace attributes or remain constant independent of the symbol size on the graph.
Declaration
Swift
public var itemSizing: ItemSizing? -
Sets the width (in px) of the legend item symbols (the part other than the title.text).
Declaration
Swift
public var itemWidth: Double? -
Determines the behavior on legend item click.
toggle toggles the visibility of the item clicked on the graph. toggleothers makes the clicked item the sole visible item on the graph. false disable legend item click interactions.
See moreDeclaration
Swift
public enum ItemClick : Encodable -
Determines the behavior on legend item click.
toggle toggles the visibility of the item clicked on the graph. toggleothers makes the clicked item the sole visible item on the graph. false disable legend item click interactions.
Declaration
Swift
public var itemClick: ItemClick? -
Determines the behavior on legend item double-click.
toggle toggles the visibility of the item clicked on the graph. toggleothers makes the clicked item the sole visible item on the graph. false disable legend item double-click interactions.
See moreDeclaration
Swift
public enum ItemDoubleClick : Encodable -
Determines the behavior on legend item double-click.
toggle toggles the visibility of the item clicked on the graph. toggleothers makes the clicked item the sole visible item on the graph. false disable legend item double-click interactions.
Declaration
Swift
public var itemDoubleClick: ItemDoubleClick? -
Sets the x position (in normalized coordinates) of the legend.
Defaults to 1.02 for vertical legends and defaults to 0 for horizontal legends.
Declaration
Swift
public var x: Double? -
Sets the legend’s horizontal position anchor.
This anchor binds the
xposition to the left, center or right of the legend. Value auto anchors legends to the right forxvalues greater than or equal to 2/3, anchors legends to the left forxvalues less than or equal to 1/3 and anchors legends with respect to their center otherwise.Declaration
Swift
public var xAnchor: XAutoAnchor? -
Sets the y position (in normalized coordinates) of the legend.
Defaults to 1 for vertical legends, defaults to -0.1 for horizontal legends on graphs w/o range sliders and defaults to 1.1 for horizontal legends on graph with one or multiple range sliders.
Declaration
Swift
public var y: Double? -
Sets the legend’s vertical position anchor This anchor binds the
yposition to the top, middle or bottom of the legend.Value auto anchors legends at their bottom for
yvalues less than or equal to 1/3, anchors legends to at their top foryvalues greater than or equal to 2/3 and anchors legends with respect to their middle otherwise.Declaration
Swift
public var yAnchor: YAutoAnchor? -
Controls persistence of legend-driven changes in trace and pie label visibility.
Defaults to
layout.uirevision.Declaration
Swift
public var uiRevision: Anything? -
Sets the vertical alignment of the symbols with respect to their associated text.
Declaration
Swift
public var verticalAlign: VerticalAlign? -
Undocumented
Declaration
Swift
public var title: LegendTitle? -
init(backgroundColor:borderColor: borderWidth: font: orientation: traceOrder: traceGroupGap: itemSizing: itemWidth: itemClick: itemDoubleClick: x: xAnchor: y: yAnchor: uiRevision: verticalAlign: title: ) Creates
Legendobject with specified properties.Declaration
Swift
public init(backgroundColor: Color? = nil, borderColor: Color? = nil, borderWidth: Double? = nil, font: Font? = nil, orientation: Orientation? = nil, traceOrder: TraceOrder? = nil, traceGroupGap: Double? = nil, itemSizing: ItemSizing? = nil, itemWidth: Double? = nil, itemClick: ItemClick? = nil, itemDoubleClick: ItemDoubleClick? = nil, x: Double? = nil, xAnchor: XAutoAnchor? = nil, y: Double? = nil, yAnchor: YAutoAnchor? = nil, uiRevision: Anything? = nil, verticalAlign: VerticalAlign? = nil, title: LegendTitle? = nil)Parameters
backgroundColorSets the legend background color.
borderColorSets the color of the border enclosing the legend.
borderWidthSets the width (in px) of the border enclosing the legend.
fontSets the font used to text the legend items.
orientationSets the orientation of the legend.
traceOrderDetermines the order at which the legend items are displayed.
traceGroupGapSets the amount of vertical space (in px) between legend groups.
itemSizingDetermines if the legend items symbols scale with their corresponding trace attributes or remain constant independent of the symbol size on the graph.
itemWidthSets the width (in px) of the legend item symbols (the part other than the title.text).
itemClickDetermines the behavior on legend item click.
itemDoubleClickDetermines the behavior on legend item double-click.
xSets the x position (in normalized coordinates) of the legend.
xAnchorSets the legend’s horizontal position anchor.
ySets the y position (in normalized coordinates) of the legend.
yAnchorSets the legend’s vertical position anchor This anchor binds the
yposition to the top, middle or bottom of the legend.uiRevisionControls persistence of legend-driven changes in trace and pie label visibility.
verticalAlignSets the vertical alignment of the symbols with respect to their associated text.
title
View on GitHub
Install in Dash
Legend Structure Reference