PERGOLA LOGO

pergola.Legend

System events: NO.

User events and functions: NO.

Example.

Listed: class properties/methods; prototype properties and methods; instance properties. Prototype properties and methods inherited by the Class superclass are not listed.

class

None

prototype

PROPERTIES

parent

pergola.user.

display

"block" – string.

"font-size"

Defined in pergola.presentationAttributes – string or number (user space units).

METHODS

toggleOn()

Shows the legend.

toggleOff()

Hides the legend.

move(x, y)

Translates this container to x, y.

build(object)

this inherits the properties specified in object. Prototype properties specified in object are overridden. Creates elements. Returns this.

instance

name

String. If not passed to the constructor, gets a generated XML name (Class).

id

String. The return value of this name.toXML(). This container ID. Used as prefix where other elements' IDs are attributed.

owner

If specified, designates the owner object.

vSpacing

If specified, the line height is increased by its number value.

textAttributes

If specified, an object whose properties are <text> element attributes specified using SVG vocabulary and grammar.

legend

Must be specified in the initialization object. Object defining a collection of legend lines. Each item in the collection is an object defining the art object and caption string properties. A legend item looks like this:

legend : {
  "The red line" : {
    art : {
      elements : [
        {element : "path", d : "M0,-2 h 60", fill : "none", stroke : "#F0F0F0", "stroke-width" : 4},
        {element : "path", d : "M0,-2 h 60", fill : "none", stroke : "#F80000", "stroke-width" : 4, "stroke-dasharray" : "9,8"}
      ]
    },
    caption : "The red line"
  },
  ...
}

In the elements array you may recognize the format expected by the SVG() node builder, but note that the appendTo property must not be specified.

caption can be a string (for single line), or an array of strings (for multiple lines).

container

<g> element.

text elements

Collection of properties; <text> element for each property name in this legend. Where this legend.caption defines multiple lines, <tspan> elements are added to the text element. The <text> elements are rendered with the attributes defined in this textAttributes.

Note: the artwork elements are not referenced.