net.moioli.drawables
Class LegendElement

java.lang.Object
  extended by net.moioli.drawables.LegendElement
All Implemented Interfaces:
DrawableI

public class LegendElement
extends java.lang.Object
implements DrawableI

Represents an element in a DefaultChart's legend.

Version:
2005/10/5
Author:
Silvio Moioli

Constructor Summary
LegendElement()
          Default constructor (empty LegendElement).
LegendElement(java.lang.String description, int length, double value)
          Standard constructor.
 
Method Summary
 void drawMe(GraphicsI g, Scale s, java.lang.Object c)
          Implements DrawableI drawing this object.
 int getHeight(GraphicsI g)
          Return this LegendElement's height.
 double maxY(double minX, double maxX)
          Since the Legend will be drawn regardless of the scale, always return NaN.
 double minY(double minX, double maxX)
          Since the Legend will be drawn regardless of the scale, always return NaN.
 void setXY(int x, int y)
          Moves this element changing the x and y relative positioning coordinate.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LegendElement

public LegendElement()
Default constructor (empty LegendElement).


LegendElement

public LegendElement(java.lang.String description,
                     int length,
                     double value)
Standard constructor.

Parameters:
description - a description string to be drawn near this element
length - the length (in pixels) of this element
value - the numeric (real) value of the segment represented by this element
Method Detail

setXY

public void setXY(int x,
                  int y)
Moves this element changing the x and y relative positioning coordinate.

Parameters:
x - the new abscissa (relative to the Legend)
y - the new ordinate (relative to the Legend

drawMe

public void drawMe(GraphicsI g,
                   Scale s,
                   java.lang.Object c)
Implements DrawableI drawing this object.

Specified by:
drawMe in interface DrawableI
Parameters:
g - the surface where this object will be drawn
s - the DefaultChart's Scale object
c - the color to be used for drawing

getHeight

public int getHeight(GraphicsI g)
Return this LegendElement's height.

Parameters:
g - the surface where this object will be drawn
Returns:
the height

maxY

public double maxY(double minX,
                   double maxX)
Since the Legend will be drawn regardless of the scale, always return NaN.

Specified by:
maxY in interface DrawableI
Parameters:
minX - the minimum x value represented in this DefaultChart
maxX - the maximum x value represented in this DefaultChart
Returns:
NaN

minY

public double minY(double minX,
                   double maxX)
Since the Legend will be drawn regardless of the scale, always return NaN.

Specified by:
minY in interface DrawableI
Parameters:
minX - the minimum x value represented in this DefaultChart
maxX - the maximum x value represented in this DefaultChart
Returns:
NaN