Create a new Legend.
Name | Type | Description |
---|---|---|
viewer |
Viewer |
The viewer |
options |
Object |
Attributes used to create the legend |
meta |
Object |
optional
User-defined Meta data to add to the legend. |
Extends
Members
-
anchorAnchor
-
Get or set legend anchor
-
backgroundColorColor
-
Get or set the backgroundColor. When setting the color, a string representing the color or a
Color
object can be used. For details seeColor
. -
canvasCanvas
-
Get the canvas.
-
defaultFontFont
-
Get or set the default font. When setting the font, a string representing the font or a
Font
object can be used. For details seeFont
. -
defaultFontColorColor
-
Get or set the defaultFontColor. When setting the color, a string representing the color or a
Color
object can be used. For details seeColor
. -
defaultMinArcLengthNumber
-
Get or set the defaultMinArcLength for legend items. The value must be between 0 to 2 pixels [Default: 1]. Minimum arc length refers to the minimum size (in pixels) an arc will be drawn. At some scales, small features will have an arc length of a fraction of a pixel. In these cases, the arcs are hard to see. A minArcLength of 0 means no adjustments will be made.
-
layoutLayout
-
Get the layout.
-
metaBoolean
-
Get or Set the meta data of this object. See the meta data tutorial for details.
-
onString
-
Get or set where the legend should be position: 'canvas', 'map'
-
positionPosition
-
Get or set the position
-
sequenceSequence
-
Get the sequence.
-
textAlignmentString
-
Get or set the text alignment. Possible values are left, or right.
-
viewerViewer
-
Get the viewer.
-
visibleBoolean
-
Get or Set the visibility of this object.
Methods
-
addItems(data){CGArray.<LegendItem>}
-
Add one or more legendItems (see attributes). See adding records for details
Name Type Description data
Object | Array Object or array of objects describing the legendItems
Returns:
Type Description CGArray.<LegendItem> CGArray of added legendItems -
Clear the box containing the legend
-
inherited deleteFromObjects()
-
Remove the object from Viewer.objects
-
findLegendItemByName(name){LegendItem}
-
Find the legendItem with the provided name or return undefined.
Name Type Description name
String Name of legendItem
Returns:
Type Description LegendItem Returns undefined if not found -
findLegendItemOrCreate(name, color, decoration){LegendItem}
-
Find the legendItem with the provided name or create a new legendItem.
Name Type Default Description name
String Unknown Name of legendItem
color
Color null Use this color if creating a new legendItem
decoration
String arc Use this decoration if creating a new legendItem
Returns:
Type Description LegendItem -
Invert colors of all legendItems
-
items(term){LegendItem|CGArray}
-
Returns a CGArray of legendItems or a single legendItem. See reading records for details.
Name Type Description term
Integer | String | Array See CGArray.get for details.
Returns:
Type Description LegendItem | CGArray -
Move a legendItem from one index to a new one
Name Type Description oldIndex
Number Index of legendItem to move (0-based)
newIndex
Number New index for the legendItem (0-based)
-
Move to the Legend position (if it's position on the map)
Name Type Description duration
Number Duration of the animation
-
Remove legendItems. See removing records for details
Name Type Description items
LegendItem | Array legendItem or a array of legendItems to remove
-
Returns JSON representing the object
-
Return the class name as a string.
Returns:
Type Description String - 'Legend'
-
Update legend attributes. See updating records for details.
Name Type Description attributes
Object Object describing the properties to change
-
Update attributes for one or more legendItems. See updating records for details.
Name Type Description itemsOrUpdates
LegendItem | Array | Object legendItem, array of legendItems or object describing updates
attributes
Object Object describing the properties to change