Fork me on GitHub

Legend

Legend constructor. You should not call this method directly, but rather use graph.makeLegend

Constructor

new Legend( )

Example
var legend = graph.makeLegend( {  backgroundColor: 'rgba(255, 255, 255, 0.8)',
frame: true,
frameWidth: 1,
frameColor: 'black',
paddingTop: 10,
paddingLeft: 10,
paddingBottom: 10,
paddingRight: 10,
frameRounding: 3,

movable: false,

shapesToggleable: true,
isSerieHideable: true,
isSerieSelectable: true
} );

Members

seriesHideable :Boolean

Type:
  • Boolean

Methods

applyStyle( )

Re-applies the legend style

fixSeries( GraphSerie, Array.<GraphSerie> …a )

Re-applies the legend style
Parameters:
Name Type Attributes Description
a GraphSerie | Array.<GraphSerie> <repeatable>
serie or an array of series

{SVGGroupElement} getDom( )

Returns:
{ SVGGroupElement } The SVG group element wrapping the legend

{Boolean} isHideable( )

Returns:
{ Boolean } true or false depending if the series can be hidden or not

{Boolean} isSelectable( )

Returns:
{ Boolean } true or false depending if the series can be selected or not

{Boolean} isToggleShapes( )

Returns:
{ Boolean } true or false depending if the series can be t or not

setPosition( Position position , String alignToX , String alignToY )

Sets the position of the legend
Parameters:
Name Type Description
position Position the position to set the legend to versus the graph main axes (Graph#getXAxis and Graph#getYAxis)
alignToX String "right" or "left". References the legend right or left boundary using the position parameter
alignToY String "top" or "bottom". References the legend top or bottom boundary using the position parameter
Example
legend.setPosition( { x: 'max', y: '0px' }, 'right', 'top' ); // The rightmost side of the legend will at the maximum value of the axis, and will be positioned at the top

update( )

Updates the legend position and content