ChartLegend Class
ChartLegend provides a legend for a chart.
Item Index
Methods
Properties
Attributes
Methods
_destroyLegendItems
()
private
Destroys legend items.
_drawLegend
()
private
Draws the legend
_getDefaultStyles
()
protected
Returns the default hash for the styles attribute.
Returns:
_getLegendItem
-
shapeProps -
shapeClass -
fill -
border -
text -
width -
height -
text
Returns a legend item consisting of the following properties:
- node
- The
Nodecontaining the legend item elements. - shape
- The
Shapeelement for the legend item. - textNode
- The
Nodecontaining the text> - text
Parameters:
-
shapePropsNodeReference to the
nodeattribute. -
shapeClassString | ClassThe type of shape
-
fillObjectProperties for the shape's fill
-
borderObjectProperties for the shape's border
-
textStringString to be rendered as the legend's text
-
widthNumberTotal width of the legend item
-
heightNumberTotal height of the legend item
-
textHTML | StringText for the legendItem
Returns:
_getPlotDefaults
()
protected
Gets the default values for series that use the utility. This method is used by
the class' styles attribute's getter to get build default values.
Returns:
_getShapeClass
()
private
Evaluates and returns correct class for drawing a shape.
Returns:
_getStylesBySeriesType
-
The
Retrieves the marker styles based on the type of series. For series that contain a marker, the marker styles are returned.
Parameters:
-
TheCartesianSeries | PieSeriesseries in which the style properties will be received.
Returns:
_handleSizeChange
-
e
Updates the legend when the size changes.
Parameters:
-
eObjectEvent object.
_positionChangeHandler
-
e
Handles position changes.
Parameters:
-
eObjectEvent object
_updateBackground
-
styles
Updates the background for the legend.
Parameters:
-
stylesObjectReference to the legend's styles attribute
_updateHandler
-
e
Handles changes to legend.
Parameters:
-
eObjectEvent object
bindUI
()
private
destructor
()
protected
Destructor implementation ChartLegend class. Removes all items and the Graphic instance from the widget.
initializer
()
private
Initializes the chart.
renderUI
()
private
syncUI
()
private
Properties
_layout
Unknown
private
Maps layout classes.
Attributes
direction
String
Indicates the direction in relation of the legend's layout. The direction of the legend is determined by its
position value.
height
Number
The height of the legend. Depending on the implementation of the ChartLegend, this value is readOnly. By default, the legend is included in the layout of the Chart that
it references. Under this circumstance, height is always readOnly. When the legend is rendered in its own dom element, the readOnly status is determined by the
direction of the legend. If the position is top or bottom or the direction is horizontal, height is readOnly. If the position is left or right or the direction
is vertical, height can be explicitly set. If height is not explicitly set, the height will be determined by the width of the legend's parent element.
includeInChartLayout
Boolean
private
Indicates whether the chart's contentBox is the parentNode for the legend.
position
String
Indicates the position and direction of the legend. Possible values are left, top, right and bottom. Values of left and
right values have a direction of vertical. Values of top and bottom values have a direction of horizontal.
styles
Object
Properties used to display and style the ChartLegend. This attribute is inherited from Renderer. Below are the default values:
- gap
- Distance, in pixels, between the
ChartLegendinstance and the chart's content. WhenChartLegendis rendered within aChartinstance this value is applied. - hAlign
- Defines the horizontal alignment of the
itemsin aChartLegendrendered in a horizontal direction. This value is applied when the instance'spositionis set to top or bottom. This attribute can be set to left, center or right. The default value is center. - vAlign
- Defines the vertical alignment of the
itemsin aChartLegendrendered in vertical direction. This value is applied when the instance'spositionis set to left or right. The attribute can be set to top, middle or bottom. The default value is middle. - item
- Set of style properties applied to the
itemsof theChartLegend.- hSpacing
- Horizontal distance, in pixels, between legend
items. - vSpacing
- Vertical distance, in pixels, between legend
items. - label
- Properties for the text of an
item.- color
- Color of the text. The default values is "#808080".
- fontSize
- Font size for the text. The default value is "85%".
- marker
- Properties for the
itemmarkers.- width
- Specifies the width of the markers.
- height
- Specifies the height of the markers.
- background
- Properties for the
ChartLegendbackground.- fill
- Properties for the background fill.
- color
- Color for the fill. The default value is "#faf9f2".
- border
- Properties for the background border.
- color
- Color for the border. The default value is "#dad8c9".
- weight
- Weight of the border. The default values is 1.
width
Number
The width of the legend. Depending on the implementation of the ChartLegend, this value is readOnly. By default, the legend is included in the layout of the Chart that
it references. Under this circumstance, width is always readOnly. When the legend is rendered in its own dom element, the readOnly status is determined by the
direction of the legend. If the position is left or right or the direction is vertical, width is readOnly. If the position is top or bottom or the direction
is horizontal, width can be explicitly set. If width is not explicitly set, the width will be determined by the width of the legend's parent element.
