graph » legend

legend

[ root » graph » legend ]

Create a legend object to add a legend to your chart. Refer to the Legend Tutorial for more information.




AttributeTypeDescription
alignStringAutomatically aligns the legend and adjusts "plotarea" margins accordingly.
Accepted Values: defaultValue
alphaNumberSets the transparency level of the object. Values must range between 0.0 and 1.0, with 0.0 being completely transparent and 1.0 being completely opaque. Note that values require the leading 0 before the decimal point.
Default Value: 1
anchorStringAllows you to set an object's anchor position
Accepted Values: ['tl', 'tr', 'bl', 'br', 'c', 't', 'r', 'b', 'l']
Default Value: 'tl'
angleNumberSets the rotation angle of the object/shape.
Default Value: 0
angleEnd
angle-end
NumberSets the end angle of a pie shape.
Default Value: 360
angleStart
angle-start
NumberSets the beginning angle of a pie shape.
Default Value: 0
backgroundClip
background-clip
BooleanClips the background image to the margins of the shape/box.
Default Value: true
backgroundColor
background-color
StringSets the background color of the object. Colors can be entered by name (e.g., "purple", "blue"), hexadecimal notation (e.g., "#666699", #33ccff"), or RGB notation (e.g., "rgb(255,0,0)", "rgb(0,0,255)")
Default Value: null
backgroundColor1
background-color-1
StringSets the first color of a 2 color background gradient of the object. To be used with background-color-2.
Default Value: null
backgroundColor2
background-color-2
StringSets the second color of a 2 color background gradient of the object. To be used with background-color-1.
Default Value: null
backgroundFit
background-fit
StringSets the direction/s on which the background image is being "stretched".
Default Value: ''
backgroundImage
background-image
StringSets a background image for the object. Value can be a local file or a web image's location.
Default Value: ''
backgroundPosition
background-position
StringSets the position of the background when the background-repeat value is no-repeat.
Default Value: '50% 50%'
backgroundRepeat
background-repeat
StringSets the repeating mode for the background image.
Default Value: 'repeat'
backgroundScale
background-scale
NumberScales the background image using the specified ratio.
Default Value: 1
boldBooleanSets whether the text is displayed with bold characters or not.
Default Value: false
borderString,NumberSets the border width of the object. Can be a single value or a string of values, setting the values in the order "top right bottom left"
borderAlpha
border-alpha
NumberSets the transparency level of the border on the object. Values must range between 0.0 and 1.0, with 0.0 being completely transparent and 1.0 being completely opaque. Note that values require the leading 0 before the decimal point.
Default Value: 1
Introduced in: v2.1.1
borderBottom
border-bottom
StringSets the object's bottom border style. Accepts solid, dashed, and dotted styles.
Default Value: ''
borderColor
border-color
StringSets the border color of the object.
Default Value: '#000'
borderLeft
border-left
StringSets the object's left border style. Accepts solid, dashed, and dotted styles.
borderRadius
border-radius
NumberSets the object's border radius for rounded corners. Larger values create rounder corners, while smaller values create sharper corners. A single value will affect all 4 corners; multiple values will have separate effects on each corner, with the first value affecting the top-left corner, the second value affecting the top-right corner, and so on, in a clockwise direction. A negative value will cut a corner off without rounding.
Default Value: 0
borderRadiusBottomLeft
border-radius-bottom-left
NumberSets the object's bottom-left border radius for rounded corners. Larger values create rounder corners, while smaller values create sharper corners. A negative value will cut a corner off without rounding.
Default Value: 0
borderRadiusBottomRight
border-radius-bottom-right
NumberSets the object's bottom-right border radius for rounded corners. Larger values create rounder corners, while smaller values create sharper corners. A negative value will cut a corner off without rounding.
Default Value: 0
borderRadiusTopLeft
border-radius-top-left
NumberSets the object's top-left border radius for rounded corners. Larger values create rounder corners, while smaller values create sharper corners. A negative value will cut a corner off without rounding.
Default Value: 0
borderRadiusTopRight
border-radius-top-right
NumberSets the object's top-right border radius for rounded corners. Larger values create rounder corners, while smaller values create sharper corners. A negative value will cut a corner off without rounding.
Default Value: 0
borderRight
border-right
StringSets the object's right border style. Accepts solid, dashed, and dotted styles.
Default Value: ''
borderTop
border-top
StringSets the object's top border style. Accepts solid, dashed, and dotted styles.
Default Value: ''
borderWidth
border-width
NumberSets the border width of the object.
Default Value: 0
bottomState
bottom-state
ObjectSets the style for a copy of the object which is placed below the object itself.
Introduced in: v1.14.0
calloutBooleanSets whether an object will have a callout arrow or not.
Default Value: false
calloutExtension
callout-extension
NumberSets the length of the extension that extends beyond the tip of the callout arrow.
Default Value: 0
calloutHeight
callout-height
NumberSets the height of the object's callout arrow. A larger value will create a taller callout arrow.
Default Value: 8
calloutHook
callout-hook
Array.Sets the point of the tip of the callout arrow to a specified coordinate on the chart, with the starting point of [0,0] being the top left corner of the chart.
Default Value: null
calloutOffset
callout-offset
NumberSets the offset along the callout direction of the arrow's base. Positive and negative values can be used to offset the callout arrow up, down, left, or right depending on the callout-position.
Default Value: 0
calloutPosition
callout-position
StringSets the position for the object's callout arrow. The position is "bottom" by default.
Default Value: 'bottom'
calloutRatio
callout-ratio
Array.Sets how much to stretch/squeeze the callout arrow on its two sides. A zero value for example on one side would create like a half callout arrow. Negative values can also be set, in order to create various aspects.
Default Value: [1, 1]
calloutTip
callout-tip
ZCStyleTo style the tip of the callout. You can modify the shape with a "type" attribute. Value options include "circle", "diamond", "cross", and "arrow". For styling, use attributes such as "background-color", "border-color", "border-width", "line-color", "line-width", and so on.
Default Value: null
calloutWidth
callout-width
NumberSets the width of the object's callout arrow. A larger value will create a wider callout arrow.
Default Value: 8
centerRef
center-ref
BooleanSets the (0,0) x/y coordinates as the center of the box (instead of the top-left corner).
Default Value: false
classStringSets a class value on the object.
Default Value: null
clipText
clip-text
BooleanTruncates text based on the setting of width.
Default Value: false
collapseBooleanSets legend to be collapsed by default
Accepted Values: defaultValue
Introduced in: v2.6.2
colorStringSets the object's font color. Similar to font-color.
Default Value: '#000'
cursorStringSets the cursor shape when hovering over the object.
Default Value: 'auto'
Introduced in: v1.9.0
dragHandler
drag-handler
StringSets the handler used to drag the legend: icon will create a dragging icon on the legend header, which will be the only area on which you can click and drag; header will make the whole header object active for dragging the legend.
Accepted Values: defaultValue
draggableBooleanSets whether the legend can be dragged or not.
Accepted Values: defaultValue
fillAngle
fill-angle
NumberSets the angle of the axis along which the linear gradient is drawn.
Default Value: 90
fillOffsetX
fill-offset-x
NumberSets an X offset to apply to the fill.
Default Value: 0
fillOffsetY
fill-offset-y
NumberSets a Y offset to apply to the fill.
Default Value: 0
fillType
fill-type
String,NumberSets the background gradient fill type to either linear or radial.
Default Value: 'linear'
flatBooleanDisables the active area (used for tooltip) for the object.
Default Value: false
fontFamily
font-family
StringSets the text's font family.
fontSize
font-size
NumberSets the text's font size.
fontStyle
font-style
StringSets the text's font style.
Accepted Values: ['normal', 'italic', 'oblique']
fontWeight
font-weight
StringSets the text's font weight. Similar to bold.
Default Value: 'normal'
footerObjectSets the styling for the legend footer.
Accepted Values: defaultValue
gradientColors
gradient-colors
StringSets a set of colors for a complex background gradient consisting of 2 or more colors. To be used with gradient-stops.
Default Value: ''
gradientStops
gradient-stops
StringSets the gradient stops for a complex background gradient consisting of 2 or more colors. To be used with gradient-colors.
Default Value: ''
groupNumberSets a group id for the shared legends. In case one legend item is toggled, the similar items on shared legend with same group id will be toggled.
Accepted Values: defaultValue
headerObjectSets the styling for the legend header.
Accepted Values: defaultValue
heightNumberSet the object's height.
Default Value: 0
highlightLegend
highlight-legend
BooleanHighlights legend elements (item and marker) whenever a plot is being hovered.
Accepted Values: defaultValue
highlightPlot
highlight-plot
BooleanAn alias for the "highlight" attribute in the "plot" object. Highlights the corresponding plot when the legend item is moused over.
Accepted Values: defaultValue
iconObjectWhen a legend is set to draggable with an icon drag-handler, the icon object allows you to customize the appearance of the drag-handler icon.
Accepted Values: defaultValue
idStringSets the id of the object.
Default Value: ''
idStringID of the shape
Default Value: ''
italicBooleanSets whether the text is displayed with italicized characters or not.
Default Value: false
itemObjectSets the styling for the active legend items.
Accepted Values: defaultValue
itemStringSets the item id of the map on which the object/shape is being added.
Default Value: ''
itemOff
item-off
ObjectSets the styling for the inactive legend items.
Accepted Values: defaultValue
itemToggleAction
item-toggle-action
StringSimilar to toggleAction, except that it applies on clicks on legend items.
Accepted Values: defaultValue
layoutStringSets the layout for the legend items.
Accepted Values: ['horizontal', 'h', 'vertical', 'v', 'row x col', 'x col', 'row x', 'float'] defaultValue
lineCap
line-cap
StringSets the stroke-linecap attribute on SVGs
Accepted Values: ['butt', 'round', 'square']
Default Value: 'butt'
lineColor
line-color
StringSets the line color of the object, applicable on non-closed shapes. See also border-color for closed shapes.
Default Value: '#000'
lineGapSize
line-gap-size
String,NumberCan be used to create custom dashed or dotted lines when used with line-segment-size. This will control the size of the gaps between each line segment.
Default Value: 0
lineHeight
line-height
NumberSets the height of a line box.
Default Value: -1
lineJoin
line-join
StringSets the stroke-linejoin attribute on SVGs
Accepted Values: ['round', 'miter']
Default Value: 'round'
lineSegmentSize
line-segment-size
String,NumberCan be used to create custom dashed or dotted lines when used with line-gap-size. This will control the size of the visible segment of line.
Default Value: 0
lineStyle
line-style
StringSets the line style of the object.
Default Value: ''
lineWidth
line-width
NumberSets the line width of the object, applicable on non-closed shapes. See also border-width for closed shapes.
Default Value: 0
mapStringSets the map id of the map on which the object/shape is being added.
marginNumberSets the object's margin/s from the top-left of the chart.
Default Value: 0
marginBottom
margin-bottom
NumberSets the object's bottom margin.
Default Value: -1
marginLeft
margin-left
NumberSets the object's left margin.
Default Value: -1
marginRight
margin-right
NumberSets the object's right margin.
Default Value: -1
marginTop
margin-top
NumberSets the object's top margin.
Default Value: -1
markerObjectSets the styling for the legend markers.
Accepted Values: defaultValue
markerOff
marker-off
ObjectSets the styling for the inactive legend markers.
Accepted Values: defaultValue
markerToggleAction
marker-toggle-action
StringSimilar to toggleAction, except that it applies on clicks on legend markers.
Accepted Values: defaultValue
maxChars
max-chars
NumberSets the maximum numbers of characters displayed in the object. The value determines how many characters will be displayed before the text is cut and appended with "..."
Default Value: 0
maxItems
max-items
NumberSets the maximum number of items displayed on the legend. To be used with overflow.
Accepted Values: defaultValue
maxWidth
max-width
NumberSets a maximum width of the object.
minimizeBooleanSets whether the legend can be minimized or not.
Accepted Values: defaultValue
offsetR
offset-r
NumberSets an R offset to apply when positioning the object/shape.
Default Value: 0
offsetX
offset-x
NumberSets an X offset to apply when positioning the object/shape.
Default Value: 0
offsetY
offset-y
NumberSets a Y offset to apply when positioning the object/shape.
Default Value: 0
offsetZ
offset-z
NumberSets a Z offset to apply when positioning the object/shape.
Default Value: 0
overflowStringSets the display mode for legend items beyond max-items setting: none will display all items; hidden will display just top max-items items; page will enable the pagination module; scroll will enable legend scrolling, with top max-items items per page. To be used with max-item.
Accepted Values: defaultValue
overlapBooleanSets whether the object allows overlapping with other labels. If false, and two objects overlap, only one will be displayed.
Default Value: true
paddingNumberSets the object's padding around the text. Up to four values can be entered to set the padding for all four sides, with the first value affecting the top padding, the second value affecting the right padding, and so on, in a clockwise direction.
Default Value: null
paddingBottom
padding-bottom
NumberSets the object's bottom padding around the text.
Default Value: 2
paddingLeft
padding-left
NumberSets the object's left padding around the text.
Default Value: 2
paddingRight
padding-right
NumberSets the object's right padding around the text.
Default Value: 2
paddingTop
padding-top
NumberSets the object's top padding around the text.
Default Value: 2
pageOff
page-off
ObjectWhen using pagination in a legend, the page-off item is an arrow that is no longer able to be clicked because the legend is displaying either the first or the last page.
Accepted Values: defaultValue
pageOn
page-on
ObjectWhen using pagination in a legend, the page-on item is an arrow that is still able to be clicked.
Accepted Values: defaultValue
pageStatus
page-status
ObjectAllows you to style the page-status object, which appears in a legend when pagination is being used. The page-status indicator generally displays the current legend page.
Accepted Values: defaultValue
pointsArray.Sets the coordinates of the object/shape points.
Default Value: []
positionStringSets the object's position relative to its container. Similar results can be obtained by setting [margin] and [margin-...] attributes. Uses x,y coordinates originating from the top left of the chart.
Default Value: ''
rectShortcut
rect-shortcut
BooleanUsed to force the library to create rectangles using a faster drawing API (instead of painting them like a closed polygon). However, using this would disable effects like rounded borders. It is a performance setting for edge cases.
Default Value: false
rtlBooleanRenders text right-to-left. Default value is false.
Default Value: false
scrollObjectConfigures the scroll bar and handle.
Accepted Values: defaultValue
scrollObjectTo enable legend scrolling.
Accepted Values: defaultValue
shadowBooleanSets whether the object's shadow is visible or not. Has limited effect on HTML5 implementation.
Default Value: false
shadowAlpha
shadow-alpha
NumberSets the transparency of the shadow of the object. The higher the value, the less transparent the shadow will be.
Default Value: 0.75
shadowAngle
shadow-angle
NumberSets the angle of the shadow underneath the object.
Default Value: 45
shadowBlur
shadow-blur
String,NumberSets the blur effect size for the shadow of the object. Has limited effect on HTML5 implementation.
Default Value: 0
shadowColor
shadow-color
StringSets the color of the shadow of the object.
Default Value: '#999'
shadowDistance
shadow-distance
String,NumberSets the distance between the shadow and the object.
Default Value: 2
sharedBooleanFor graphsets with multiple chart objects, setting this attribute to true within the legend object of each chart will allow you to use one legend to toggle data on or off for each chart simultaneously. It should be noted that while each chart must have a legend object, the visible attribute can be set to false to hide a legend.
Accepted Values: defaultValue
sizeNumberSets the size of the object/shape.
Default Value: 0
size2
size-2
NumberSets the secondary size of the object/shape. Used on ellipses or rectangle shapes.
Default Value: 0
sliceNumberSets the radius of the inner ring of a pie shape.
Default Value: 0
targetStringSets the target for the URL. Depending on its value, it either opens the URL or uses the content fetched from the URL (when target is graph=ID).
Accepted Values: _blank, _top, _parent, _window=NAME, graph=ID
Default Value: null
textStringSets the text content of the object.
Default Value: null
textAlign
text-align
StringSets the text's horizontal alignment relative to the object's box.
Default Value: 'center'
textDecoration
text-decoration
StringSets the text's decoration to use underlined characters. Similar to underline. May not display properly in Mozilla Firefox when charts are rendered using SVG.
Default Value: 'none'
textHeight
text-height
NumberSets the height of the text
Default Value: 0
textWidth
text-width
NumberSets the width of the text
Default Value: 0
toggleAction
toggle-action
StringSets the action performed on legend item toggle: hide will simply hide the respective plot; remove will repaint the chart without considering the respective plot; disabled will not generate any action for the legend items/markers.
Accepted Values: defaultValue
tooltipObjectLegend tooltips appear when users hover over the items in the legend.
Accepted Values: defaultValue
topState
top-state
ZCShapeSets the style for a copy of the object which is placed above the object itself.
Introduced in: v1.14.0
typeStringSets the type of the object/shape.
Accepted Values: ['arc', 'arrow', 'circle', 'cross', 'diamond', 'ellipse','gear3', 'gear4', 'gear5', 'gear6', 'gear7', 'gear8', 'gear9', 'hamburger', 'line', 'parallelogram', 'pie','plus', 'poly', 'rect', 'rpoly3', 'rpoly4', 'rpoly5', 'rpoly6', 'rpoly7', 'rpoly8', 'rpoly9', 'square', 'star3', 'star4', 'star5', 'star6', 'star7', 'star8', 'star9', 'trapezoid', 'triangle']
Default Value: 'poly'
underlineBooleanSets whether the text is displayed with underlined characters or not.
Default Value: false
urlStringSets an URL associated with this object. Used mostly on nodes/labels/shapes with their associated click events.
Default Value: null
verticalAlign
vertical-align
StringAutomatically aligns the legend and adjusts "plotarea" margins accordingly.
Accepted Values: defaultValue
verticalAlign
vertical-align
StringSets the text's vertical alignment to one of the three applicable values, relative to the object's box.
Default Value: 'middle'
visibleBooleanSets the visibility of the object. Allows you to turn off the object without removing lines of JSON.
Default Value: true
widthNumberSets the object's width.
Default Value: 0
wrapText
wrap-text
BooleanSets whether the text will wrap, depending on the width of the object.
Default Value: false
xNumberSets the X position of the object.
Default Value: -1
yNumberSets the Y position of the object.
zIndex
z-index
NumberSets the z position of the object. Objects with higher z indexes will appear "above" those with lower z index values.
Default Value: 1
zSort
z-sort
NumberUsed to force the sorting of the active areas (which trigger the tooltip) of two shapes in case they overlap.
Default Value: 1