org.jCharts

## Class Legend

- java.lang.Object
- - org.jCharts.Legend

- All Implemented Interfaces:
    Serializable, HTMLTestable

      public final class Legend
      extends Object
      implements HTMLTestable, Serializable

  Version:
    $Id: Legend.java,v 1.17 2003/04/19 01:39:17 nathaniel_auvil Exp $
  Author:
    Nathaniel Auvil, Sandor Dornbush, Sundar Balasubramanian
  See Also:
    Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `private Chart` | `chart`
    `private ArrayList` | `fillPointsFlags`
    `private float` | `height`
    `private float` | `iconSide`
    `private ArrayList` | `labels`
    `private LegendProperties` | `legendProperties`
    `private int` | `numColumns`
    `private int` | `numRows`
    `private ArrayList` | `paints`
    `private ArrayList` | `pointOutlinePaints`
    `private ArrayList` | `shapes`
    `private TextProcessor` | `textProcessor`
    `private float` | `widestLabelAndColumnPadding`
    `private float` | `width`
    `private float` | `x`
    `private float` | `y`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Legend(Chart chart)` Deprecated.
    `Legend(Chart chart, LegendProperties legendProperties)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `calculateDrawingValues(IData iData)` Calculates the width and height needed to display the Legend.
    `void` | `computeLegendXY(IAxisDataSeries iAxisDataSeries, float chartTitleHeight)`
    `private void` | `determineWidthAndHeight(int numberOfLabels)` Determines the dimensions needed for the Legend and creates the image for it.
    `int` | `getHeight()`
    `LegendProperties` | `getLegendProperties()`
    `float` | `getWidth()`
    `private void` | `processData(IAxisDataSeries iAxisDataSeries)` Central method for processing data; try to minimize looping.
    `private void` | `processData(IPieChartDataSet iPieChartDataSet)` Central method for processing data; try to minimize looping.
    `private void` | `processLegendLabels(IAxisPlotDataSet iAxisPlotDataSet)` Method for processing data for AxisPlot datasets; try to minimize looping.
    `private void` | `processLegendLabels(IPieChartDataSet iPieChartDataSet)` Method for processing data for PieCharts; try to minimize looping.
    `void` | `render()` Renders the legend.
    `void` | `setX(float x)`
    `void` | `setY(float y)`
    `void` | `toHTML(HTMLGenerator htmlGenerator)` Enables the testing routines to display the contents of this Object.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### chart

          private Chart chart

    - #### legendProperties

          private LegendProperties legendProperties

    - #### iconSide

          private float iconSide

    - #### widestLabelAndColumnPadding

          private float widestLabelAndColumnPadding

    - #### numColumns

          private int numColumns

    - #### numRows

          private int numRows

    - #### textProcessor

          private TextProcessor textProcessor

    - #### x

          private float x

    - #### y

          private float y

    - #### width

          private float width

    - #### height

          private float height

    - #### labels

          private ArrayList labels

    - #### paints

          private ArrayList paints

    - #### shapes

          private ArrayList shapes

    - #### fillPointsFlags

          private ArrayList fillPointsFlags

    - #### pointOutlinePaints

          private ArrayList pointOutlinePaints

  - ### Constructor Detail

    - #### Legend

          public Legend(Chart chart)

      Deprecated.
      Parameters:
        `chart` -

    - #### Legend

          public Legend(Chart chart,
                        LegendProperties legendProperties)

      Parameters:
        `chart` -
        `legendProperties` -

  - ### Method Detail

    - #### setX

          public void setX(float x)

    - #### setY

          public void setY(float y)

    - #### computeLegendXY

          public void computeLegendXY(IAxisDataSeries iAxisDataSeries,
                                      float chartTitleHeight)

      Parameters:
        `iAxisDataSeries` -
        `chartTitleHeight` -

    - #### processData

          private void processData(IAxisDataSeries iAxisDataSeries)

      Central method for processing data; try to minimize looping. 1) calculate the maximum height of labels 2) find the maximum label width
      Parameters:
        `iAxisDataSeries` -

    - #### processData

          private void processData(IPieChartDataSet iPieChartDataSet)

      Central method for processing data; try to minimize looping. 1) calculate the maximum height of labels 2) find the maximum label width
      Parameters:
        `iPieChartDataSet` -

    - #### processLegendLabels

          private void processLegendLabels(IAxisPlotDataSet iAxisPlotDataSet)

      Method for processing data for AxisPlot datasets; try to minimize looping. 1) calculate the maximum height of labels 2) find the maximum label width
      Parameters:
        `iAxisPlotDataSet` -

    - #### processLegendLabels

          private void processLegendLabels(IPieChartDataSet iPieChartDataSet)

      Method for processing data for PieCharts; try to minimize looping. 1) calculate the maximum height of labels 2) find the maximum label width
      Parameters:
        `iPieChartDataSet` -

    - #### getLegendProperties

          public LegendProperties getLegendProperties()

    - #### calculateDrawingValues

          public void calculateDrawingValues(IData iData)

      Calculates the width and height needed to display the Legend. Use the getWidth() and getHeight() methods to extract this information.
      Parameters:
        `iData` - can pass either the IPieChartDataSet or the IChartDataSeries to this.

    - #### getWidth

          public float getWidth()

    - #### getHeight

          public int getHeight()

    - #### determineWidthAndHeight

          private void determineWidthAndHeight(int numberOfLabels)

      Determines the dimensions needed for the Legend and creates the image for it.

    - #### render

          public void render()

      Renders the legend.

    - #### toHTML

          public void toHTML(HTMLGenerator htmlGenerator)

      Enables the testing routines to display the contents of this Object.
      Specified by:
        `toHTML` in interface `HTMLTestable`
      Parameters:
        `htmlGenerator` -