new LegendItem(viewer, options, meta)
Create a new legendItem. By default a legendItem will use its parent legend defaultFont, and defaultFontColor.
Name | Type | Description |
---|---|---|
viewer |
Viewer |
The viewer |
options |
Object |
Attributes used to create the legendItem |
meta |
Object |
optional
User-defined Meta data to add to the legendItem. |
Extends
Members
-
canvasCanvas
-
Get the canvas.
-
decorationString
-
Get or set the decoration. Choices are arc [Default], arrow, score, none.
-
drawSwatchBoolean
-
Get or set the drawSwatch property. If true a swatch will be drawn beside the legendItem text.
-
fontFont
-
Get or set the font. When setting the font, a string representing the font or a
Font
object can be used. For details seeFont
. -
fontColorColor
-
Get or set the fontColor. When setting the color, a string representing the color or a
Color
object can be used. For details seeColor
. -
heightNumber
-
Get the height in pixels. This will be the same as the font size.
-
layoutLayout
-
Get the layout.
-
legendLegend
-
Get the Legend
-
metaBoolean
-
Get or Set the meta data of this object. See the meta data tutorial for details.
-
minArcLengthNumber
-
Get or set the minArcLength 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.
-
nameString
-
Get or set the name. The name is the text shown for the legendItem. When setting a name, if it's not unique it will be appended with a number. For example, if 'my_name' already exists, it will be changed to 'my_name-2'.
-
sequenceSequence
-
Get the sequence.
-
swatchColorColor
-
Get or set the swatchColor. When setting the color, a string representing the color or a
Color
object can be used. For details seeColor
. -
swatchWidthNumber
-
Get the swatch width (same as legendItem height).
-
usingDefaultFontBoolean
-
Returns true if using the default legend font
-
usingDefaultMinArcLengthBoolean
-
Returns true if using the default min arc length
-
viewerViewer
-
Get the viewer.
-
visibleBoolean
-
Get or Set the visibility of this object.
-
widthNumber
-
Get the width in pixels.
Methods
-
inherited deleteFromObjects()
-
Remove the object from Viewer.objects
-
Returns the features that have this legendItem
Name Type Description term
Integer | String | Array See CGArray.get for details.
Returns:
Type Description Feature | CGArray -
highlight(color)
-
Highlight this legendItem
Name Type Description color
Color Color for the highlight
-
invertColors()
-
Invert the swatch color
-
move(newIndex)
-
Move this legendItem to a new index in the array of Legend legendItems.
Name Type Description newIndex
Number New index for this caption (0-based)
-
Returns the plots that have this legendItem
Name Type Description term
Integer | String | Array See CGArray.get for details.
Returns:
Type Description Feature | CGArray -
remove()
-
Remove legendItem
-
toJSON()
-
Returns JSON representing the object
-
toString(){String}
-
Return the class name as a string.
Returns:
Type Description String - 'LegendItem'
-
update(attributes)
-
Update legendItem attributes. See updating records for details.
Name Type Description attributes
Object Object describing the properties to change