|
NetCharts Pro | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnetcharts.pro.common.NFBaseClass
netcharts.pro.common.NFLegend
public class NFLegend
The NFLegend property describes a chart's legend. The legend object has many options for configuring text, background, layout, and location properties. A typical use of this object is as follows:
... Font font = new Font("Comic Sans MS", Font.PLAIN, 10); NFLegend legend = new NFLegend(new NFLabel("Legend", black, font), new NFRegion(Color.gray, NFRegion.RAISED, 2)); legend.setLocation(NFLegend.BOTTOM); legend.setOrientation(NFLegend.HORIZONTAL); chart.setLegend(legend); ...This would create a horizontal legend at the bottom of the chart that would use the dataset names or (slice labels) as the legend items.
Developers may opt to explicitly specify the legend item symbols and colors by passing in NFLegendItem objects via the setLegendItems or addLegendItem method calls. An example of this usage is shown here:
... Font font = new Font("Comic Sans MS", Font.PLAIN, 10); NFLegend legend = new NFLegend(new NFLabel("Legend", black, font), new NFRegion(Color.gray, NFRegion.RAISED, 2)); legend.addLegendItem(new NFLegendItem("item 1", NFLegendItemSymbol.CROSS, Color.yellow)); legend.addLegendItem(new NFLegendItem("item 2", NFLegendItemSymbol.DIAMOND, Color.blue)); legend.addLegendItem(new NFLegendItem("item 3", NFLegendItemSymbol.SQUARE, Color.red)); legend.addLegendItem(new NFLegendItem("", NFLegendItemSymbol.NONE, Color.white)); // space legend.addLegendItem(new NFLegendItem("item 4", NFLegendItemSymbol.CIRCLE, Color.green)); chart.setLegend(legend); ...This would create a vertically oriented legend at the right side of the chart (default) The legend would have a gap between the first three items and the last.
Field Summary | |
---|---|
static int |
BOTTOM
Bottom legend location |
static int |
BOTTOMLEFT
Bottom left legend location |
static int |
BOTTOMRIGHT
Bottom right legend location |
static int |
CENTER
Center legend location. |
static int |
HORIZONTAL
Horizontal legend orientation. |
static int |
LEFT
Left legend location |
static java.util.Hashtable |
legendItemOrderMap
legendItemOrderMap hashtable |
static java.util.Hashtable |
legendOrientationMap
legendOrientationMap hashtable |
static java.util.Hashtable |
legendPositionMap
legendPositionMap hashtable |
static java.util.Hashtable |
legendSymbolPositionMap
legendSymbolPositionMap hashtable |
static int |
RIGHT
Right legend location |
static int |
SETDISPLAYORDER
Inverse data set legend item order |
static int |
SETNAMEORDER
Data set legend item order |
static int |
TOP
Top legend location |
static int |
TOPLEFT
Top left legend location. |
static int |
TOPRIGHT
Top right legend location |
static int |
VERTICAL
Vertical legend orientation. |
Constructor Summary | |
---|---|
NFLegend()
Constructs a default legend object |
|
NFLegend(java.util.Hashtable state)
Constructs a legend using CDL parameters |
|
NFLegend(NFLabel label,
NFRegion region)
Constructs a legend object using the given NFLabel text object and background NFRegion object. |
Method Summary | |
---|---|
void |
addActiveLabel(NFActiveLabel activeLabel)
Add an active label item to the list of active labels. |
void |
addLegendItem(NFLegendItem legendItem)
Add a legend item to the list of legend items. |
void |
addLegendLabel(java.lang.String label)
Add a legend label to the list of legend labels. |
java.lang.Object |
clone()
Clone this legend. |
NFVector |
getActiveLabels()
Returns the list of active labels for this legend. |
NFAxisMap |
getAxisMap()
Returns the axis map for this legend |
java.lang.String |
getCDLItemBorder()
Generate CDL parameters representing outlines for all the legend item symbols. |
java.lang.String |
getCDLLegendLayout()
Generate CDL parameters representing the legend layout |
java.lang.String |
getCDLMaxSize()
Generate CDL parameters representing the legend max size |
java.lang.String |
getCDLSymbolPosition()
Generate CDL parameters representing the legend item symbol position relative to the label. |
java.util.Vector |
getCDLVector()
NFLegend is a compound object representing multiple CDL parameters. |
int |
getColumns()
Get the number of columns to be used when laying out legend items. |
java.awt.Color |
getFillColor()
Gets the legend fill (background) color. |
java.awt.Font |
getFont()
Gets the legend text font or null if not set. |
NFLine |
getItemBorder()
Returns the line representing the border outlines of the legend item symbols. |
int |
getItemOrder()
Get the order legend items should render. |
int |
getJustify()
Get legend justify. |
NFLabel |
getLabel()
Gets the NFLabel object (text characteristics) object for this legend. |
boolean |
getLegendEnabled()
Returns the state of the legend |
NFVector |
getLegendItems()
Get vector of NFLegendItems. |
NFVector |
getLegendLabels()
Get vector of legend labels. |
int |
getLocation()
Get the legend's location |
java.awt.Dimension |
getMaxSize()
Get legend max size. |
int |
getOrientation()
Get the legend's orientation |
NFPoint |
getPosition()
Get legend position |
NFRegion |
getRegion()
Gets the NFRegion object (background characteristics) object for this legend. |
int |
getSymbolPosition()
Get the legend item symbol's position relative to the label. |
java.lang.String |
getText()
Gets the title text for the legend. |
int |
getTextAngle()
Gets the text angle for the legend items. |
java.awt.Color |
getTextColor()
Gets the color of the legend text |
void |
setActiveLabels(NFVector activeLabels)
Sets a vector of NFActiveLabels for this legend object. |
void |
setAxisMap(NFAxisMap axisMap)
Set the axis map for this legend. |
void |
setCDLItemBorder(java.lang.Object cdl)
Configures the legend item symbol outlines from a CDL parameter representation. |
void |
setCDLLegendLayout(java.lang.String s)
Configures the legend layout attributes from a CDL parameter representation. |
void |
setCDLMaxSize(java.lang.String cdl)
Configures the legend max size attributes from a CDL parameter representation. |
void |
setCDLSymbolPosition(java.lang.String cdl)
Configures the legend symbol position attribute from a CDL parameter representation. |
void |
setColumns(int columns)
Set the number of columns to be used when laying out legend items. |
void |
setFillColor(java.awt.Color fillColor)
Sets the legend fill (background) color. |
void |
setFont(java.awt.Font font)
Sets the font for the legend text. |
void |
setItemBorder(NFLine legendItemBorder)
Explicitly define the border outline of all legend item symbols. |
void |
setItemOrder(int itemOrder)
Set the order in which the legend items appear. |
void |
setJustify(int justify)
Set legend justification. |
void |
setLabel(NFLabel label)
Explicitly sets the NFLabel (text characteristics) object for this legend. |
void |
setLegendEnabled(boolean enabled)
Enables or disables the legend |
void |
setLegendItems(NFVector legendItems)
Explicitly set legend items. |
void |
setLegendLabels(NFVector labels)
Explicitly set legend labels. |
void |
setLocation(int location)
Set the legend's location using a constant. |
void |
setMaxSize(java.awt.Dimension maxSize)
Set legend max size - performs mandatory clip if legend items become too large. |
void |
setOrientation(int orientation)
Set the legend's orientation using a constant. |
void |
setPosition(NFPoint position)
Set legend position. |
void |
setRegion(NFRegion region)
Explicitly sets the NFRegion (background characteristics) object for this legend. |
void |
setSymbolPosition(int symbolPosition)
Set the position all legend item symbols should appear relative to the legend item labels. |
void |
setText(java.lang.String text)
Sets the title for the legend. |
void |
setTextAngle(int textAngle)
Sets text angle for the legend items. |
void |
setTextColor(java.awt.Color color)
Sets the color of the legend text. |
Methods inherited from class netcharts.pro.common.NFBaseClass |
---|
getModified, getUserObject, setModified, setUserObject |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int VERTICAL
public static final int HORIZONTAL
public static final int TOPLEFT
public static final int TOP
public static final int TOPRIGHT
public static final int LEFT
public static final int CENTER
public static final int RIGHT
public static final int BOTTOMLEFT
public static final int BOTTOM
public static final int BOTTOMRIGHT
public static final int SETNAMEORDER
public static final int SETDISPLAYORDER
public static java.util.Hashtable legendOrientationMap
public static java.util.Hashtable legendPositionMap
public static java.util.Hashtable legendItemOrderMap
public static java.util.Hashtable legendSymbolPositionMap
Constructor Detail |
---|
public NFLegend()
public NFLegend(NFLabel label, NFRegion region)
label
- The label object containing the text style and legend title.region
- The region object describing the legend background.public NFLegend(java.util.Hashtable state)
state
- Hashtable containing CDL parameters.Method Detail |
---|
public java.lang.Object clone() throws java.lang.CloneNotSupportedException
clone
in class NFBaseClass
java.lang.CloneNotSupportedException
public void setOrientation(int orientation)
VERTICAL or HORIZONTAL
. By default, the legend
will be vertically oriented.
If the value passed is not a valid orientation, an
IllegalArgumentException will be thrown.
orientation
- The orientation type.public int getOrientation()
VERTICAL (default) or HORIZONTAL
public void setLocation(int location)
TOPLEFT, TOP, TOPRIGHT, LEFT, CENTER, RIGHT, BOTTOMLEFT, BOTTOM,
BOTTOMRIGHT
The default, the legend will be placed on
the right side.
If the value passed is not a valid legend location, an
IllegalArgumentException will be thrown.
Note that "CENTER" is only valid in charts contain rectangular
axes (e.g., Barchart, Bubblechart, Combochart, Stockchart, Linechart, XYchart).
location
- A constant representing the location.public int getLocation()
TOPLEFT, TOP, TOPRIGHT, LEFT, CENTER, RIGHT (default), BOTTOMLEFT, BOTTOM,
BOTTOMRIGHT
public void setPosition(NFPoint position)
position
- A NFPoint object representing the legend position.public NFPoint getPosition()
public void setMaxSize(java.awt.Dimension maxSize)
maxSize
- Dimension representing the maximum size of the NFLegend.public java.awt.Dimension getMaxSize()
public void setJustify(int justify)
TOPLEFT, TOP, TOPRIGHT, LEFT, CENTER (default), RIGHT, BOTTOMLEFT, BOTTOM,
BOTTOMRIGHT
If the value passed is not a valid legend justify value, an
IllegalArgumentException will be thrown.
justify
- A constant representing the legend justification.public int getJustify()
TOPLEFT, TOP, TOPRIGHT, LEFT, CENTER, RIGHT, BOTTOMLEFT, BOTTOM,
BOTTOMRIGHT
public void setColumns(int columns)
columns
- The number of columns to use.public int getColumns()
public void setItemOrder(int itemOrder)
itemOrder
- The order legend items should render. One of
SETNAMEORDER, SETDISPLAYORDER
public int getItemOrder()
SETNAMEORDER, SETDISPLAYORDER
public void setSymbolPosition(int symbolPosition)
symbolPosition
- The position legend items should appear relative
to the legend item label. One of LEFT, RIGHT
public int getSymbolPosition()
LEFT, RIGHT
public void addLegendItem(NFLegendItem legendItem)
legendItem
- The new NFLegendItem to add to the list of legend items.public void setLegendItems(NFVector legendItems)
legendItems
- A vector of NFLegendItems.public NFVector getLegendItems()
public void addLegendLabel(java.lang.String label)
label
- The new String to add to the list of legend labels.public void setLegendLabels(NFVector labels)
labels
- A vector of Strings.public NFVector getLegendLabels()
public void setText(java.lang.String text)
text
- The legend title.public java.lang.String getText()
public void setFont(java.awt.Font font)
font
- Legend font.public java.awt.Font getFont()
public void setTextAngle(int textAngle)
angle
- The angle to rotate the legend items.public int getTextAngle()
public void setTextColor(java.awt.Color color)
color
- Color of the legend text.public java.awt.Color getTextColor()
public void setFillColor(java.awt.Color fillColor)
fillColor
- The legend background color.public java.awt.Color getFillColor()
public void setLabel(NFLabel label)
label
- public NFLabel getLabel()
public void setRegion(NFRegion region)
region
- public NFRegion getRegion()
public void addActiveLabel(NFActiveLabel activeLabel)
activeLabel
- The new NFActiveLabel to add to the list of active labels..public void setActiveLabels(NFVector activeLabels)
activeLabels
- Vector of NFActiveLabelspublic NFVector getActiveLabels()
public void setAxisMap(NFAxisMap axisMap)
axisMap
- Axis map to usepublic NFAxisMap getAxisMap()
public void setLegendEnabled(boolean enabled)
enabled
- If true, legend will be shown.public boolean getLegendEnabled()
public NFLine getItemBorder()
public void setItemBorder(NFLine legendItemBorder)
legendItemBorder
- Line representing the legend symbol border outlinespublic java.lang.String getCDLLegendLayout()
(Orientation, Location, X, Y, Justify, Columns)
public void setCDLLegendLayout(java.lang.String s)
cdl
- CDL in the form: (Orientation, Location, X, Y, Justify, Columns)
public java.lang.String getCDLMaxSize()
(maxWidth, maxHeight)
public void setCDLMaxSize(java.lang.String cdl)
cdl
- CDL in the form: (maxWidth, maxHeight)
public java.lang.String getCDLSymbolPosition()
sybomPosition
public void setCDLSymbolPosition(java.lang.String cdl)
cdl
- CDL in the form: symbolPosition
public java.lang.String getCDLItemBorder()
(lineType, lineWidth, lineColor)
public void setCDLItemBorder(java.lang.Object cdl)
cdl
- CDL in the form: (lineType, lineWidth, lineColor)
public java.util.Vector getCDLVector()
|
NetCharts Pro | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Visual Mining, Inc. | Copyright © Visual Mining, Inc. 1996 - 2011 |
Last Modified: Jun 28, 2011 |