|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.quinncurtis.chart2djava.ChartObj
com.quinncurtis.chart2djava.GraphObj
com.quinncurtis.chart2djava.Legend
public abstract class Legend
The Legend is the abstract base class for all legend classes. I manages the legend rectangle position, size and background color and fill color.
Field Summary |
---|
Constructor Summary | |
---|---|
Legend()
The default Legend constructor. |
Method Summary | |
---|---|
void |
addLegendGeneralText(int ntextpos)
Add a blank header, subhead, or footer to the current legend. |
void |
addLegendGeneralText(int ntextpos,
ChartText textobj)
Add a header, subhead, or footer to the current legend. |
void |
addLegendGeneralText(int ntextpos,
java.lang.String stext,
java.awt.Color rgbcolor,
java.awt.Font thefont)
Add a header, subhead, or footer to the current legend. |
boolean |
checkIntersection(ChartPoint2D testpoint,
NearestPointData np)
Returns true if the test point intersects the legend rectangle. |
void |
copy(Legend source)
Copies the source legend object. |
void |
draw(java.awt.Graphics2D g2)
The abstract draw method for this class. |
int |
errorCheck(int nerror)
Checks the legend object for common errors. |
boolean |
getAutoSizeLegendRectangle()
Returns the a flag that specifies whether the legend rectangle is auto-sized. |
double |
getHorizontalSpacing()
Returns the horizontal spacing between legend items. |
ChartRectangle2D |
getInnerLegendRectangle()
Returns the location of the inner legend rectangle. |
double |
getLegendBorderRect(int nborder)
Returns one of the four legend border values. |
ChartText |
getLegendGeneralText(int item)
Returns an ChartText object representing a header, subhead, or footer to the current legend. |
double |
getLegendHeight()
Returns the height of the legend rectangle in normalized coordinates. |
double |
getLegendWidth()
Returns the width of the legend rectangle in normalized coordinates. |
ChartPoint2D |
getSize()
Returns the width and height of the legend rectangle. |
double |
getVerticalSpacing()
Returns the vertical row spacing between legend items. |
void |
initLegendPosition(double rx,
double ry,
double rwidth,
double rheight)
an Legend constructor that initializes the position, size, color attributes, and layout1 mode of the legend. |
void |
setAutoSizeLegendRectangle(boolean autosize)
Sets the a flag that specifies whether the legend rectangle is auto-sized. |
void |
setChartObjScale(PhysicalCoordinates transform)
Sets the reference to the PhysicalCoordinates object that the chart object is placed in. |
void |
setHorizontalSpacing(double hspace)
Sets the horizontal spacing between legend items. |
void |
setLegendBorderRect(int nborder,
double rvalue)
Sets one of the four legend border values. |
void |
setLegendHeight(double rheight)
Sets the height of the legend rectangle in normalized coordinates. |
void |
setLegendWidth(double rwidth)
Sets the width of the legend rectangle in normalized coordinates. |
void |
setSize(double rwidth,
double rheight)
Set the width and height of the legend rectangle. |
void |
setVerticalSpacing(double vspace)
Sets the vertical row spacing between legend items. |
Methods inherited from class com.quinncurtis.chart2djava.ChartObj |
---|
copy, getChartObjIDCntr, getChartObjType, getThisChartObjID, TypeSafeVectorCopy |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Legend()
Method Detail |
---|
public void addLegendGeneralText(int ntextpos)
ntextpos
- Specifies whether a header, subhead or footer is being added. Use one of the
following constants: LEGEND_HEADER, LEGEND_SUBHEAD or LEGEND_FOOTER.public void addLegendGeneralText(int ntextpos, ChartText textobj)
ntextpos
- Specifies whether a header, subhead or footer is being added. Use one of the
following constants: LEGEND_HEADER, LEGEND_SUBHEAD or LEGEND_FOOTER.textobj
- An TextObject that specifies the text string, color and font of the header or footer.public void addLegendGeneralText(int ntextpos, java.lang.String stext, java.awt.Color rgbcolor, java.awt.Font thefont)
ntextpos
- Specifies whether a header, subhead or footer is being added. Use one of the following
constants: LEGEND_HEADER, LEGEND_SUBHEAD or LEGEND_FOOTER.stext
- Specifies the text string.rgbcolor
- Specifies the text color.thefont
- Specifies the text font.public boolean checkIntersection(ChartPoint2D testpoint, NearestPointData np)
checkIntersection
in class GraphObj
testpoint
- The test pointnp
- Nearest point information for data based objects.
public void copy(Legend source)
source
- The source legend object.public void draw(java.awt.Graphics2D g2)
draw
in class GraphObj
g2
- The graphics context.public int errorCheck(int nerror)
errorCheck
in class GraphObj
nerror
- Current error state
public boolean getAutoSizeLegendRectangle()
public double getHorizontalSpacing()
public ChartRectangle2D getInnerLegendRectangle()
public double getLegendBorderRect(int nborder)
nborder
- Specifies which legend border to return. Use one of the border constants:
LEFT_BORDER, TOP_BORDER, RIGHT_BORDER or BOTTOM_BORDER.
public ChartText getLegendGeneralText(int item)
item
- Specifies whether a header, subhead or footer is being added. Use one of the
following constants: LEGEND_HEADER, LEGEND_SUBHEAD or LEGEND_FOOTER.public double getLegendHeight()
public double getLegendWidth()
public ChartPoint2D getSize()
public double getVerticalSpacing()
public void initLegendPosition(double rx, double ry, double rwidth, double rheight)
rx
- The x-position, in chart normalized coordinates, of the legend rectangle.ry
- The y-position, in chart normalized coordinates, of the legend rectangle.rwidth
- The width, in chart normalized coordinates, of the legend rectangle.rheight
- The height, in chart normalized coordinates, of the legend rectangle.public void setAutoSizeLegendRectangle(boolean autosize)
autosize
- Sets the autoSizeLegendRectangle flag.public void setChartObjScale(PhysicalCoordinates transform)
setChartObjScale
in class GraphObj
transform
- A reference to the PhysicalCoordinates object that the chart object is placed inpublic void setHorizontalSpacing(double hspace)
hspace
- Sets the horizontal spacing between legend items.public void setLegendBorderRect(int nborder, double rvalue)
nborder
- Specifies which legend border to set. Use one of the border constants: LEFT_BORDER,
TOP_BORDER, RIGHT_BORDER or BOTTOM_BORDER.rvalue
- The border value in chart normalized coordinates.public void setLegendHeight(double rheight)
rheight
- Sets the height of the legend rectangle in normalized coordinates.public void setLegendWidth(double rwidth)
rwidth
- Sets the width of the legend rectangle in normalized coordinates.public void setSize(double rwidth, double rheight)
rwidth
- The width, in chart normalized coordinates, of the legend rectangle.rheight
- The height, in chart normalized coordinates, of the legend rectangle.public void setVerticalSpacing(double vspace)
vspace
- Sets the vertical row spacing between legend items.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |