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
Node
containing the legend item elements. - shape
- The
Shape
element for the legend item. - textNode
- The
Node
containing the text> - text
Parameters:
-
shapeProps
NodeReference to the
node
attribute. -
shapeClass
String | ClassThe type of shape
-
fill
ObjectProperties for the shape's fill
-
border
ObjectProperties for the shape's border
-
text
StringString to be rendered as the legend's text
-
width
NumberTotal width of the legend item
-
height
NumberTotal height of the legend item
-
text
HTML | 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:
-
The
CartesianSeries | PieSeriesseries in which the style properties will be received.
Returns:
_handleSizeChange
-
e
Updates the legend when the size changes.
Parameters:
-
e
ObjectEvent object.
_positionChangeHandler
-
e
Handles position changes.
Parameters:
-
e
ObjectEvent object
_updateBackground
-
styles
Updates the background for the legend.
Parameters:
-
styles
ObjectReference to the legend's styles attribute
_updateHandler
-
e
Handles changes to legend.
Parameters:
-
e
ObjectEvent 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
ChartLegend
instance and the chart's content. WhenChartLegend
is rendered within aChart
instance this value is applied. - hAlign
- Defines the horizontal alignment of the
items
in aChartLegend
rendered in a horizontal direction. This value is applied when the instance'sposition
is 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
items
in aChartLegend
rendered in vertical direction. This value is applied when the instance'sposition
is 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
items
of 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
item
markers.- width
- Specifies the width of the markers.
- height
- Specifies the height of the markers.
- background
- Properties for the
ChartLegend
background.- 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.