public class Legend
extends java.lang.Object
implements java.io.Serializable
Modifier and Type | Field and Description |
---|---|
static int |
BOTTOM
Bottom legend position.
|
static int |
LEFT
Left legend position.
|
static int |
RIGHT
Right legend position.
|
static int |
TOP
Top legend position.
|
Constructor and Description |
---|
Legend()
Creates a legend.
|
Modifier and Type | Method and Description |
---|---|
java.awt.Color |
getLabelColor(int index)
Gets the color of the label of the specified series.
|
java.awt.Color |
getLegendColor(int index)
Gets legend entry's color value by it's index.
|
java.awt.Color[] |
getLegendColors()
Gets the legend colors.
|
int |
getLegendColumns()
Gets the number of columns used to display the legend labels.
|
java.lang.String |
getLegendImage(int index)
Gets a legend entry's image name.
|
java.lang.String[] |
getLegendLabels()
Gets the legend labels.
|
int |
getLegendPosition()
Gets the legend position.
|
boolean |
isLegendBoxSizeAsFont()
Check if the legend box size should be the same as the legend font size.
|
boolean |
isLegendOn()
Checks if the legend is turned on.
|
boolean |
isLegendReverseOn()
Returns true if the inverted legend is on.
|
void |
setLabelColor(int index,
java.awt.Color color)
Sets the color of of the label for the specified legend entry.
|
void |
setLegendBoxSizeAsFont(boolean on)
If set to true the legend box size is set to the same size as the legend font.
|
void |
setLegendColor(int index,
java.awt.Color color)
Sets a legend entry color.
|
void |
setLegendColors(java.awt.Color[] colors)
Sets the legend colors.
|
void |
setLegendColumns(int columns)
Sets the number of columns that should be used to display legend labels.
|
void |
setLegendImage(int index,
java.lang.String name)
Sets an image to be used in front of the legend label.
|
void |
setLegendLabels(java.lang.String[] labels)
Sets the legend labels.
|
void |
setLegendOn(boolean on)
Turns on or off the label legend.
|
void |
setLegendPosition(int position)
Sets the legend position.
|
void |
setLegendReverseOn(boolean on)
Set on or off the inverted legend.
|
public static final int BOTTOM
public static final int LEFT
public static final int RIGHT
public static final int TOP
public java.awt.Color getLabelColor(int index)
index
- The index of the series (0-based).java.lang.IllegalArgumentException
- if the series index is invalid.public java.awt.Color getLegendColor(int index)
index
- The index of the legend entry to get color from.public java.awt.Color[] getLegendColors()
public int getLegendColumns()
public java.lang.String getLegendImage(int index)
index
- The index of the legend entry.public java.lang.String[] getLegendLabels()
setLegendLabels(java.lang.String[])
public int getLegendPosition()
public boolean isLegendBoxSizeAsFont()
public boolean isLegendOn()
public boolean isLegendReverseOn()
public void setLabelColor(int index, java.awt.Color color)
index
- The index of the legend label (0-based).color
- The color to use, null for the default color.java.lang.IllegalArgumentException
- if the legend label index is invalid.public void setLegendBoxSizeAsFont(boolean on)
on
- True or falsepublic void setLegendColor(int index, java.awt.Color color)
index
- The index of the legend entry to set Color for.color
- The color to set for the legend entry.setLegendColors(java.awt.Color[])
,
setLegendImage(int, java.lang.String)
public void setLegendColors(java.awt.Color[] colors)
colors
- The array with legend colors.java.lang.IllegalArgumentException
- if the colors is null.setLegendColors(java.awt.Color[])
,
setLegendImage(int, java.lang.String)
public void setLegendColumns(int columns)
columns
- Number of columns to display legends on. If columns is
set to 0, the default legend rendering is used.public void setLegendImage(int index, java.lang.String name)
index
- The index of the legend entry to set the image for.name
- The image to use, null for the default legend box.GenericChart.addImage(String, Image)
public void setLegendLabels(java.lang.String[] labels)
labels
- The labels to use, null for default behavior.public void setLegendOn(boolean on)
on
- True if the legend should be displayed.setLegendPosition(int)
public void setLegendPosition(int position)
position
- TOP, BOTTOM, LEFT, or RIGHT.java.lang.IllegalArgumentException
- If the position is invalid.public void setLegendReverseOn(boolean on)
on
- If true the legend entryes are displayed from bottom to
top and from right to left.