Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## jcckit.plot
Class Legend

    java.lang.Object
      jcckit.plot.Legend

public class Legend
extends java.lang.Object

Helper class for creating the legend of a `Plot`.

Author:
  Franz-Josef Elmer

Field Summary
`static java.lang.String` | `BOTTOM_DISTANCE_KEY` Configuration parameter key.
`static java.lang.String` | `BOX_ATTRIBUTES_KEY` Configuration parameter key.
`static java.lang.String` | `BOX_HEIGHT_KEY` Configuration parameter key.
`static java.lang.String` | `BOX_WIDTH_KEY` Configuration parameter key.
`static java.lang.String` | `CURVE_TITLE_ATTRIBUTES_KEY` Configuration parameter key.
`static java.lang.String` | `CURVE_TITLE_DISTANCE_KEY` Configuration parameter key.
`static java.lang.String` | `LEFT_DISTANCE_KEY` Configuration parameter key.
`static java.lang.String` | `LINE_LENGTH_KEY` Configuration parameter key.
`static java.lang.String` | `SYMBOL_SIZE_KEY` Configuration parameter key.
`static java.lang.String` | `TITLE_ATTRIBUTES_KEY` Configuration parameter key.
`static java.lang.String` | `TITLE_DISTANCE_KEY` Configuration parameter key.
`static java.lang.String` | `TITLE_KEY` Configuration parameter key.
`static java.lang.String` | `TOP_DISTANCE_KEY` Configuration parameter key.
`static java.lang.String` | `UPPER_RIGHT_CORNER_KEY` Configuration parameter key.

Constructor Summary
`Legend(ConfigParameters config)` Creates an instance from the specified configuration parameters.

Method Summary
`GraphicalElement` | `createCurveTitle(int curveIndex, int numberOfCurves, java.lang.String title)` Creates the title part of a legend symbol.
`GraphicalElement` | `createSymbol(int curveIndex, int numberOfCurves, SymbolFactory factory, boolean withLine, GraphicAttributes lineAttributes)` Creates the symbol part of a legend symbol.
`GraphicalElement` | `getBox()` Returns the legend box with title but without legend symbols and curve titles.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### UPPER_RIGHT_CORNER_KEY

    public static final java.lang.String UPPER_RIGHT_CORNER_KEY

  Configuration parameter key.

  See Also:
    Constant Field Values

### BOX_WIDTH_KEY

    public static final java.lang.String BOX_WIDTH_KEY

  Configuration parameter key.

  See Also:
    Constant Field Values

### BOX_HEIGHT_KEY

    public static final java.lang.String BOX_HEIGHT_KEY

  Configuration parameter key.

  See Also:
    Constant Field Values

### BOX_ATTRIBUTES_KEY

    public static final java.lang.String BOX_ATTRIBUTES_KEY

  Configuration parameter key.

  See Also:
    Constant Field Values

### TITLE_KEY

    public static final java.lang.String TITLE_KEY

  Configuration parameter key.

  See Also:
    Constant Field Values

### TITLE_DISTANCE_KEY

    public static final java.lang.String TITLE_DISTANCE_KEY

  Configuration parameter key.

  See Also:
    Constant Field Values

### TITLE_ATTRIBUTES_KEY

    public static final java.lang.String TITLE_ATTRIBUTES_KEY

  Configuration parameter key.

  See Also:
    Constant Field Values

### LEFT_DISTANCE_KEY

    public static final java.lang.String LEFT_DISTANCE_KEY

  Configuration parameter key.

  See Also:
    Constant Field Values

### BOTTOM_DISTANCE_KEY

    public static final java.lang.String BOTTOM_DISTANCE_KEY

  Configuration parameter key.

  See Also:
    Constant Field Values

### TOP_DISTANCE_KEY

    public static final java.lang.String TOP_DISTANCE_KEY

  Configuration parameter key.

  See Also:
    Constant Field Values

### LINE_LENGTH_KEY

    public static final java.lang.String LINE_LENGTH_KEY

  Configuration parameter key.

  See Also:
    Constant Field Values

### SYMBOL_SIZE_KEY

    public static final java.lang.String SYMBOL_SIZE_KEY

  Configuration parameter key.

  See Also:
    Constant Field Values

### CURVE_TITLE_DISTANCE_KEY

    public static final java.lang.String CURVE_TITLE_DISTANCE_KEY

  Configuration parameter key.

  See Also:
    Constant Field Values

### CURVE_TITLE_ATTRIBUTES_KEY

    public static final java.lang.String CURVE_TITLE_ATTRIBUTES_KEY

  Configuration parameter key.

  See Also:
    Constant Field Values

Constructor Detail

### Legend

    public Legend(ConfigParameters config)

  Creates an instance from the specified configuration parameters. All numbers (lengths, fontsizes, linethicknesses, etc.) are in device-independent units.

  Key & Default Value | Type | Mandatory | Description
  --- | --- | --- | ---
  `bottomDistance = 0.02` | `double` | no | Distance between the last row and the bottom of the legend box.
  `boxAttributes =` default values of `ShapeAttributes` with a white fill color. | `ConfigParameters` | no | Attributes of the legend box.
  `boxHeight = 0.1` | `double` | no | Height of the legend box.
  `boxWidth = 0.2` | `double` | no | Width of the legend box.
  `curveTitleAttributes =` default values of `BasicGraphicAttributes` | `ConfigParameters` | no | Text attributes of curve titles printed in the legend.
  `curveTitleDistance = 0.005` | `double` | no | Horizontal distance between the line part of the legend symbol and the curve title.
  `leftDistance = 0.01` | `double` | no | Horizontal distance between the line part of the legend symbol and the left border of the legend box.
  `lineLength = 0.035` | `double` | no | Length of the line part of the legend symbol.
  `symbolSize = 0.01` | `double` | no | Size of the symbol part of the legend symbol. Will be the `size` argument of `createLegendSymbol` in a `SymbolFactory`.
  `titleAttributes =` default values of `BasicGraphicAttributes` with a text anchor CENTER TOP. | `ConfigParameters` | no | Text attributes of the title of the legend box.
  `title = Legend` | `String` | no | Title of the legend box.
  `titleDistance = 0.005` | `double` | no | Distance between the center of the upper line of the legend box and the anchor of the legend title.
  `topDistance = 0.04` | `double` | no | Distance between the first row and the top of the legend box.
  `upperRightCorner = 0.94, 0.54` | `double�[]` | no | Position of the upper-right corner of the legend box.

Method Detail

### getBox

    public GraphicalElement getBox()

  Returns the legend box with title but without legend symbols and curve titles.

### createSymbol

    public GraphicalElement createSymbol(int curveIndex,
                                         int numberOfCurves,
                                         SymbolFactory factory,
                                         boolean withLine,
                                         GraphicAttributes lineAttributes)

  Creates the symbol part of a legend symbol.

  Parameters:
    `curveIndex` - Index of the curve. Will be needed to calculate the y-coordinate of the symbol.
    `numberOfCurves` - Number of curves. Will be needed to calculate the y-coordinate of the symbol.
    `factory` - Factory for the symbol part of the legend symbol. Can be `null`.
    `withLine` - `true` if the line part of the legend symbol should be created.
    `lineAttributes` - Attributes of the line part.

### createCurveTitle

    public GraphicalElement createCurveTitle(int curveIndex,
                                             int numberOfCurves,
                                             java.lang.String title)

  Creates the title part of a legend symbol.

  Parameters:
    `curveIndex` - Index of the curve. Will be needed to calculate the y-coordinate of the title.
    `numberOfCurves` - Number of curves. Will be needed to calculate the y-coordinate of the symbol.
    `title` - Title text.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD