"globals"
"marker"
"tooltip"
"gui"
"context-menu"
"button"
"gear"
"item"
"graphset"
"arrows"
"from"
"label"
"to"
"bubble-legend"
"marker"
"chart"
"color-scale"
"cursor"
"item"
"crosshair-x"
"marker"
"plot-label"
"scale-label"
"crosshair-y"
"scale-label"
"globals"
"marker"
"tooltip"
"guide"
"marker"
"plot-label"
"scale-label"
"heatmap"
"tooltip"
"images"
"labels"
"legend"
"footer"
"header"
"icon"
"item"
"item-off"
"marker"
"marker-off"
"page-off"
"page-on"
"page-status"
"scroll"
"bar"
"handle"
"tooltip"
"nav"
"back"
"tooltip"
"no-data"
"options"
"arrow"
"back"
"tooltip"
"bars"
"tooltip"
"box"
"tooltip"
"button-zoomin"
"tooltip"
"button-zoomout"
"tooltip"
"close"
"containers"
"day"
"items"
"final"
"group-box"
"tooltip"
"handle"
"indicator"
"intermediate"
"item"
"label"
"tooltip"
"item-group-n"
"label"
"tooltip"
"item-id-n"
"label"
"tooltip"
"item-level-n"
"label"
"tooltip"
"label"
"link"
"link[cls-n]"
"link[container-n]"
"link[group-n]"
"link[level-n]"
"link[parent-n]"
"link[sibling]"
"link[source-n]"
"link[target-n]"
"links"
"mmp-marker"
"label"
"month"
"item"
"items"
"outline"
"multi-guide"
"close"
"handle"
"label"
"negative"
"node"
"label"
"tooltip"
"node[cls-n]"
"label"
"tooltip"
"node[collapsed]"
"label"
"tooltip"
"node[group-n]"
"label"
"tooltip"
"node[leaf]"
"label"
"tooltip"
"node[level-n]"
"label"
"tooltip"
"node[parent]"
"label"
"tooltip"
"node[parent-n]"
"label"
"tooltip"
"nodes"
"OBJECT_KEY_NAME"
"label"
"tooltip"
"outlier"
"marker"
"tooltip"
"positive"
"scale"
"label"
"pointer"
"scale-y-2"
"guide"
"item"
"label"
"markers"
"label"
"tick"
"tooltip"
"style"
".td"
".td_even"
".td_first"
".td_last"
".td_n"
".td_n_n"
".td_odd"
".th"
".th_even"
".th_first"
".th_last"
".th_n"
".th_odd"
".tr"
".tr_even"
".tr_first"
".tr_last"
".tr_n"
".tr_odd"
"band"
"tooltip"
"chord"
"tooltip"
"flow"
"item"
"item-flow"
"item-overall"
"label"
"label-overall"
"tooltip"
"subtitle"
"tile"
"label"
"tooltip"
"title"
"tooltip-box"
"tooltip-group"
"trigger"
"value"
"violin"
"week"
"items"
"weekday"
"item"
"items"
"plot"
"error"
"facets"
"goal"
"tooltip"
"guide-label"
"guide-marker"
"highlight-marker"
"hover-marker"
"hover-state"
"styles"
"highlight-state"
"legend-item"
"legend-marker"
"max-marker"
"marker"
"min-marker"
"selected-marker"
"selected-state"
"tooltip"
"trend-down"
"trend-equal"
"trend-up"
"value-box"
"rules"
"plotarea"
"preview"
"handle"
"handle-bottom"
"handle-left"
"handle-right"
"handle-top"
"label"
"refresh"
"scale"
"item"
"scale-k"
"guide"
"item"
"tooltip"
"scale-r"
"center"
"guide"
"item"
"markers"
"label"
"ring"
"tooltip"
"scale-v"
"guide"
"item"
"tooltip"
"scale-x"
"guide"
"item"
"label"
"markers"
"label"
"tooltip"
"scale-y"
"guide"
"item"
"label"
"markers"
"tick"
"tooltip"
"scroll-x"
"bar"
"handle"
"scroll-y"
"bar"
"handle"
"selection-tool"
"series"
"error"
"facets"
"goal"
"tooltip"
"guide-label"
"guide-marker"
"highlight-marker"
"hover-marker"
"highlight-state"
"legend-item"
"legend-marker"
"marker"
"max-marker"
"min-marker"
"selected-marker"
"selected-state"
"style"
"band"
"tooltip"
"chord"
"tooltip"
"item"
"item-flow"
"item-overall"
"label"
"tooltip"
"value-box"
"rules"
"shapes"
"label"
"options"
"style"
"controls"
"zoom-in"
"tooltip"
"zoom-out"
"tooltip"
"items"
"OBECT_KEY_NAME"
"tooltip"
"label"
"tooltip"
"tooltip"
"source"
"subtitle"
"title"
"tooltip"
"zoom"
"label"
"history"
"refresh"
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.
Attribute | Type | Description |
---|---|---|
adjustLayout adjust-layout | Boolean | Set to prevent plotarea from overlapping with legend. Default Value: null |
align | String | Sets the alignment of the object.
For legends, automatically aligns the legend and adjusts "plotarea" margins accordingly ['left', 'center', 'right']. Accepted Values: ['center', 'left', 'right'] |
alpha | Number | Sets the opacity on the marker, with 0 being fully transparent and 1 being fully opaque. Note that decimal value requires the leading 0. Default Value: 1 |
angle | Number | Sets the rotation angle of the object. |
backgroundClip background-clip | Boolean | Clips the background image to the margins of the shape/box. Default Value: true |
backgroundColor background-color | String | Sets 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 | String | Sets 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 | String | Sets 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 | String | Sets the direction/s on which the background image is being "stretched". Default Value: '' |
backgroundImage background-image | String | Sets a background image for the object. Value can be a local file or a web image's location.
For patterns, the available patterns are: [`${string}`, 'PATTERN_BACKWARD_DIAGONAL', 'PATTERN_DARK_DOWNWARD_DIAGONAL', 'PATTERN_DARK_HORIZONTAL', 'PATTERN_DARK_UPWARD_DIAGONAL', 'PATTERN_DARK_VERTICAL', 'PATTERN_DASHED_DOWNWARD_DIAGONAL', 'PATTERN_DASHED_HORIZONTAL', 'PATTERN_DASHED_UPWARD_DIAGONAL', 'PATTERN_DASHED_VERTICAL', 'PATTERN_DIAGONAL_BRICK', 'PATTERN_DIAGONAL_CROSS', 'PATTERN_DIVOT', 'PATTERN_DOTTED_DIAMOND', 'PATTERN_DOTTED_GRID', 'PATTERN_FORWARD_DIAGONAL', 'PATTERN_HORIZONTAL', 'PATTERN_HORIZONTAL_BRICK', 'PATTERN_LARGE_CHECKER_BOARD', 'PATTERN_LARGE_GRID', 'PATTERN_LIGHT_DOWNWARD_DIAGONAL', 'PATTERN_LIGHT_HORIZONTAL', 'PATTERN_LIGHT_UPWARD_DIAGONAL', 'PATTERN_LIGHT_VERTICAL', 'PATTERN_NARROW_HORIZONTAL', 'PATTERN_NARROW_VERTICAL', 'PATTERN_OUTLINED_DIAMOND', 'PATTERN_PLAID', 'PATTERN_SHADE_25', 'PATTERN_SHADE_50', 'PATTERN_SHADE_75', 'PATTERN_SHINGLE', 'PATTERN_SMALL_CHECKER_BOARD', 'PATTERN_SMALL_GRID', 'PATTERN_SOLID_DIAMOND', 'PATTERN_SPHERE', 'PATTERN_TRELLIS', 'PATTERN_VERTICAL', 'PATTERN_WAVE', 'PATTERN_WEAVE', 'PATTERN_WIDE_DOWNWARD_DIAGONAL', 'PATTERN_WIDE_UPWARD_DIAGONAL', 'PATTERN_ZIGZAG']. Accepted Values: ['PATTERN_BACKWARD_DIAGONAL', 'PATTERN_DARK_DOWNWARD_DIAGONAL', 'PATTERN_DARK_HORIZONTAL', 'PATTERN_DARK_UPWARD_DIAGONAL', 'PATTERN_DARK_VERTICAL', 'PATTERN_DASHED_DOWNWARD_DIAGONAL', 'PATTERN_DASHED_HORIZONTAL', 'PATTERN_DASHED_UPWARD_DIAGONAL', 'PATTERN_DASHED_VERTICAL', 'PATTERN_DIAGONAL_BRICK', 'PATTERN_DIAGONAL_CROSS', 'PATTERN_DIVOT', 'PATTERN_DOTTED_DIAMOND', 'PATTERN_DOTTED_GRID', 'PATTERN_FORWARD_DIAGONAL', 'PATTERN_HORIZONTAL', 'PATTERN_HORIZONTAL_BRICK', 'PATTERN_LARGE_CHECKER_BOARD', 'PATTERN_LARGE_GRID', 'PATTERN_LIGHT_DOWNWARD_DIAGONAL', 'PATTERN_LIGHT_HORIZONTAL', 'PATTERN_LIGHT_UPWARD_DIAGONAL', 'PATTERN_LIGHT_VERTICAL', 'PATTERN_NARROW_HORIZONTAL', 'PATTERN_NARROW_VERTICAL', 'PATTERN_OUTLINED_DIAMOND', 'PATTERN_PLAID', 'PATTERN_SHADE_25', 'PATTERN_SHADE_50', 'PATTERN_SHADE_75', 'PATTERN_SHINGLE', 'PATTERN_SMALL_CHECKER_BOARD', 'PATTERN_SMALL_GRID', 'PATTERN_SOLID_DIAMOND', 'PATTERN_SPHERE', 'PATTERN_TRELLIS', 'PATTERN_VERTICAL', 'PATTERN_WAVE', 'PATTERN_WEAVE', 'PATTERN_WIDE_DOWNWARD_DIAGONAL', 'PATTERN_WIDE_UPWARD_DIAGONAL', 'PATTERN_ZIGZAG', `${string}`] Default Value: '' |
backgroundPosition background-position | String | Sets the position of the background when the background-repeat value is no-repeat. Default Value: '50% 50%' |
backgroundRepeat background-repeat | Boolean, String | Sets the repeating mode for the background image. Default Value: 'repeat' |
backgroundScale background-scale | Number | Scales the background image using the specified ratio. Default Value: 1 |
border | Number | Sets 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 | Number | Sets 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 | Number | Sets the object's bottom border style. Accepts solid, dashed, and dotted styles. Default Value: '' |
borderColor border-color | String | Sets the border color of the object. Default Value: '#000' |
borderLeft border-left | Number | Sets the object's left border style. Accepts solid, dashed, and dotted styles. |
borderRadius border-radius | Number | Sets 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 | Number | Sets 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 | Number | Sets 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 | Number | Sets 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 | Number | Sets 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 | Number | Sets the object's right border style. Accepts solid, dashed, and dotted styles. Default Value: '' |
borderTop border-top | Number | Sets the object's top border style. Accepts solid, dashed, and dotted styles. Default Value: '' |
borderWidth border-width | Number | Sets the border width of the object. Default Value: 0 |
bottomState bottom-state | Object | Sets the style for a copy of the object which is placed below the object itself. Introduced in: v1.14.0 |
callout | Boolean | Sets whether an object will have a callout arrow or not. Default Value: false |
calloutExtension callout-extension | Number | Sets the length of the extension that extends beyond the tip of the callout arrow. Default Value: 0 |
calloutHeight callout-height | Number | Sets the height of the object's callout arrow. A larger value will create a taller callout arrow. Default Value: 8 |
calloutHook callout-hook | Array.<Number> | 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 | Number | Sets 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 | String | Sets the position for the object's callout arrow. The position is "bottom" by default. Default Value: 'bottom' |
calloutRatio callout-ratio | Array.<Number> | 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] |
calloutWidth callout-width | Number | Sets the width of the object's callout arrow. A larger value will create a wider callout arrow. Default Value: 8 |
class | String | Sets a class value on the object. Default Value: null |
collapse | Boolean | Sets legend to be collapsed by default Introduced in: v2.6.2 |
dataN data-n | Any | Prefix attribute or array using "data-" to define a custom token. |
dragHandler drag-handler | String | Sets 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: ['header', 'icon'] Default Value: 'header' |
draggable | Boolean | Sets whether the legend can be dragged or not. |
fillAngle fill-angle | Number | Sets the angle of the axis along which the linear gradient is drawn. Default Value: 90 |
fillOffsetX fill-offset-x | Number | Sets an X offset to apply to the fill. Default Value: 0 |
fillOffsetY fill-offset-y | Number | Sets a Y offset to apply to the fill. Default Value: 0 |
fillType fill-type | String | Sets the background gradient fill type to either linear or radial. Accepted Values: ['linear', 'none', 'radial'] Default Value: 'linear' |
footer | Object | Sets the styling for the legend footer. |
gradientColors gradient-colors | String | Sets 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 | String | Sets the gradient stops for a complex background gradient consisting of 2 or more colors. To be used with gradient-colors. Default Value: '' |
group | Number | Specifies the group the object is placed in. |
header | Object | Sets the styling for the legend header. |
height | Number | Sets the object's height. Default Value: 0 |
highlightLegend highlight-legend | Boolean | Sets whether the legend entry for the plot will be highlighted when hovering the plot. |
highlightPlot highlight-plot | Boolean | An alias for the "highlight" attribute in the "plot" object. Highlights the corresponding plot when the legend item is moused over. |
icon | Object | When 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. |
id | String | Sets the id of the object. Default Value: '' |
item | Object | Sets the id or style of the item. |
itemOff item-off | Object | Sets the styling for the inactive legend items. |
itemToggleAction item-toggle-action | String | Similar to toggleAction, except that it applies on clicks on legend items. Accepted Values: ['disabled', 'hide', 'none', 'remove'] |
layout | String | Defines the layout of the items of the object. Accepted Values: ['horizontal', 'h', 'vertical', 'v', `${number}x${number}`, `x${number}`, `${number}x`, 'float'] |
lineGapSize line-gap-size | Number | Can 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 | Number | Sets the height of a line box. Default Value: -1 |
lineSegmentSize line-segment-size | Number | Can 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 | String | Sets the line style of the object. Accepted Values: ['dashdot', 'dashed', 'dotted', 'solid'] Default Value: '' |
margin | Number, String | Sets the object's margin/s from the top-left of the chart. Accepted Values: ['dynamic'] Default Value: 0 |
marginBottom margin-bottom | Number | Sets the object's bottom margin. Default Value: -1 |
marginLeft margin-left | Number | Sets the object's left margin. Default Value: -1 |
marginRight margin-right | Number | Sets the object's right margin. Default Value: -1 |
marginTop margin-top | Number | Sets the object's top margin. Default Value: -1 |
marker | Object | Sets the styling for markers. |
markerOff marker-off | Object | Sets the styling for the inactive legend markers. |
markerToggleAction marker-toggle-action | String | Similar to toggleAction, except that it applies on clicks on legend markers. Accepted Values: ['disabled', 'hide', 'none', 'remove'] |
maxItems max-items | Number | Sets the maximum number of items displayed. |
mediaRules media-rules | Array.<Object> | Configure media rules. |
minimize | Boolean | Sets whether the legend can be minimized or not. |
offsetX offset-x | Number | Sets an x-offset to apply when positioning the object. |
offsetY offset-y | Number | Sets an y-offset to apply when positioning the object. |
overflow | String | Sets 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: ['hidden', 'none', 'page', 'scroll'] |
padding | Number | Sets 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 | Number | Sets the object's bottom padding around the text. Default Value: 2 |
paddingLeft padding-left | Number | Sets the object's left padding around the text. Default Value: 2 |
paddingRight padding-right | Number | Sets the object's right padding around the text. Default Value: 2 |
paddingTop padding-top | Number | Sets the object's top padding around the text. Default Value: 2 |
pageOff page-off | Object | When 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. |
pageOn page-on | Object | When using pagination in a legend, the page-on item is an arrow that is still able to be clicked. |
pageStatus page-status | Object | Allows 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. |
position | String | Sets 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 | Boolean | Used 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 |
reserveSeries reserve-series | Boolean | Reverses the order of the legend items. Default Value: null |
scroll | Object | Presence of object enables legend. Configures the scroll bar and handle. |
shadow | Boolean | Sets whether the object's shadow is visible or not. Has limited effect on HTML5 implementation. Default Value: false |
shadowAngle shadow-angle | Number | Sets the angle of the shadow underneath the object. Default Value: false |
shared | Boolean | Shares a single legend to simutaniously apply toggle to multiple charts within a graphset. Note, set this attribute to true within each `legend` object of each chart. The `visible` attribute can be set to false to hide a legend. |
toggleAction toggle-action | String | Sets 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: ['disabled', 'hide', 'none', 'remove'] Default Value: 'remove' |
tooltip | Object | Configures the tooltip element, which appears when hovering over an object. |
topState top-state | Object | Sets the style for a copy of the object which is placed above the object itself. Introduced in: v1.14.0 |
verticalAlign vertical-align | String | Sets vertical alignment of the object.
For legend, automatically aligns and adjusts `plotarea` margins accordingly. Accepted values: ['top', 'middle', 'bottom'].
For textboxes, aligns relative to object's box. Accepted values: ['top', 'middle', 'bottom']. Accepted Values: ['bottom', 'middle', 'top'] |
visible | Boolean | Sets the visibility of the object. Allows you to turn off the object without removing lines of JSON. Default Value: true |
width | Number | Sets the object's width. Default Value: 0 |
x | Number | Sets the X position of the object. Default Value: -1 |
y | Number | Sets the Y position of the object. |
zIndex z-index | Number | Sets the z position of the object. Objects with higher z indexes will appear "above" those with lower z index values. Default Value: 1 |