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
Colorobject 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
Fontobject can be used. For details seeFont. -
defaultFontColorColor
-
Get or set the defaultFontColor. When setting the color, a string representing the color or a
Colorobject 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 dataObject | Array Object or array of objects describing the legendItems
Returns:
Type Description CGArray.<LegendItem> CGArray of added legendItems -
inherited addPluginOptions(id, options)
-
Add a plugin to the object.
Name Type Description idString The id of the plugin
optionsObject The plugin options
-
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 nameString 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 nameString Unknown Name of legendItem
colorColor null Use this color if creating a new legendItem
decorationString arc Use this decoration if creating a new legendItem
Returns:
Type Description LegendItem -
inherited hasPlugin(pluginID){Boolean}
-
Does this object have a particular plugin?
Name Type Description pluginIDString The ID of the plugin
Returns:
Type Description Boolean - Whether the object has the plugin
-
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 termInteger | 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 oldIndexNumber Index of legendItem to move (0-based)
newIndexNumber New index for the legendItem (0-based)
-
Move to the Legend position (if it's position on the map)
Name Type Description durationNumber Duration of the animation
-
inherited optionsForPlugin(pluginName){Object}
-
Get the options for a particular plugin.
Name Type Description pluginNameString The name of the plugin
Returns:
Type Description Object - The options for the plugin or undefined if the plugin is not found
-
Remove legendItems. See removing records for details
Name Type Description itemsLegendItem | 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 attributesObject Object describing the properties to change
-
Update attributes for one or more legendItems. See updating records for details.
Name Type Description itemsOrUpdatesLegendItem | Array | Object legendItem, array of legendItems or object describing updates
attributesObject Object describing the properties to change
-
inherited updatePluginOptions(id, options)
-
Update plugin options. Merge the new options with the old options.
Name Type Description idString The id of the plugin
optionsObject The plugin options