com.jinsight.jetchart
Class SliceLegend

java.lang.Object
  |
  +--com.jinsight.jetchart.SliceLegend

public class SliceLegend
extends java.lang.Object

This class implements the properties and methods of a slice legend. A SliceLegend object has no public construtor. It is owned by a Slice object and can only be accessed through a 'get' method implemented in Slice.

Slice legends can be displayed inside slices or outside pie bounds. The content of a slice legend can be specified as a value, a percentage, a label, a label and a value, a label and a percentage or a value and a percentage. The legend border can be displayed in three different styles: shadowed, lowered bevel and raised bevel.

See Also:
PieGraph, PieSerie, Slice, Slice.getSliceLegend()

Field Summary
static int INSIDE
          Constant used to place slice legend inside the respective slice area.
static int LABEL
          Constant used to set the slice legend content to respective slice title.
static int LABEL_AND_PERCENT
          Constant used to set the slice legend content to respective slice title and percentage.
static int LABEL_AND_VALUE
          Constant used to set the slice legend content to respective slice title and value.
static int LOWERED_BEVEL
          Constant used to set the slice legend border to lowered bevel.
static int OUTSIDE
          Constant used to place slice legend outside pie series bounds.
static int PERCENT
          Constant used to set the slice legend content to a percentage.
static int RAISED_BEVEL
          Constant used to set the slice legend border to raised bevel.
static int SHADOWED
          Constant used to set the slice legend border to shadowed.
static int VALUE
          Constant used to set the slice legend content to the respective slice value.
static int VALUE_AND_PERCENT
          Constant used to set slice legend content to respective slice value and percentage.
 
Method Summary
protected  void finalize()
           
 void setArrowColor(java.awt.Color arrowColor)
          Sets the color of the lines that connect slice legends with respective slices.
 void setBackground(java.awt.Color background)
          Sets the background color.
 void setBorder(int border)
          Sets the border type of the slice legend.
 void setContent(int content)
          Sets the content type of the slice legend.
 void setEnabled(boolean isEnabled)
          Enables/disables slice legend.
 void setFont(java.awt.Font font)
          Sets the font of the slice legend.
 void setForeground(java.awt.Color foreground)
          Sets the color of the text displayed in a slice legend.
 void setOpacityEnabled(boolean isOpaque)
          Enables/disables slice legend opacity.
 void setPosition(int position)
          Sets the position of this slice legend.
 void setVertexDistance(double vertexDistance)
          Sets the distance of the slice legend from slice vertex.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VALUE

public static final int VALUE
Constant used to set the slice legend content to the respective slice value.

PERCENT

public static final int PERCENT
Constant used to set the slice legend content to a percentage.

LABEL

public static final int LABEL
Constant used to set the slice legend content to respective slice title.

LABEL_AND_VALUE

public static final int LABEL_AND_VALUE
Constant used to set the slice legend content to respective slice title and value.

LABEL_AND_PERCENT

public static final int LABEL_AND_PERCENT
Constant used to set the slice legend content to respective slice title and percentage.

VALUE_AND_PERCENT

public static final int VALUE_AND_PERCENT
Constant used to set slice legend content to respective slice value and percentage.

INSIDE

public static final int INSIDE
Constant used to place slice legend inside the respective slice area.

OUTSIDE

public static final int OUTSIDE
Constant used to place slice legend outside pie series bounds.

SHADOWED

public static final int SHADOWED
Constant used to set the slice legend border to shadowed.

LOWERED_BEVEL

public static final int LOWERED_BEVEL
Constant used to set the slice legend border to lowered bevel.

RAISED_BEVEL

public static final int RAISED_BEVEL
Constant used to set the slice legend border to raised bevel.
Method Detail

setPosition

public void setPosition(int position)
Sets the position of this slice legend. If the position is set to SliceLegend.OUTSIDE, the slice legend is displayed outside pie bounds and connected with a line to the slice it refers to. Slice legends are by default displayed inside slices.
Parameters:
position - An integer value
See Also:
OUTSIDE, INSIDE, Slice

setEnabled

public void setEnabled(boolean isEnabled)
Enables/disables slice legend.
Parameters:
isEnabled - A boolean value(true/false)

setBackground

public void setBackground(java.awt.Color background)
Sets the background color. The background is only painted if slice legend opacity is set to true. Default color is white.
Parameters:
background - A Color object.
See Also:
setOpacityEnabled(boolean)

setForeground

public void setForeground(java.awt.Color foreground)
Sets the color of the text displayed in a slice legend. Default color is black.
Parameters:
foreground - A Color object.

setFont

public void setFont(java.awt.Font font)
Sets the font of the slice legend.
Parameters:
font - A Font object.

setContent

public void setContent(int content)
Sets the content type of the slice legend. A slice legend content is by default the respective slice value.
Parameters:
content - One of the constants used to define the slice legend content type.
See Also:
VALUE, LABEL, PERCENT, LABEL_AND_VALUE, LABEL_AND_PERCENT, VALUE_AND_PERCENT

setBorder

public void setBorder(int border)
Sets the border type of the slice legend. The border is shadowed by defau.t
Parameters:
border - One of the constants used to define the slice legend border type.
See Also:
SHADOWED, LOWERED_BEVEL, RAISED_BEVEL

setVertexDistance

public void setVertexDistance(double vertexDistance)
Sets the distance of the slice legend from slice vertex. By default it is 0.7.
Parameters:
vertexDistance - A double precision number. It can vary from 0 to 1.

setOpacityEnabled

public void setOpacityEnabled(boolean isOpaque)
Enables/disables slice legend opacity. By default slice legends are transparent.
Parameters:
isOpaque - A boolean value(true/false).
See Also:
setBackground(java.awt.Color)

setArrowColor

public void setArrowColor(java.awt.Color arrowColor)
Sets the color of the lines that connect slice legends with respective slices. The arrows are displayed if slice legends are painted outside pie bounds.
Parameters:
arrowColor - A Color object.
See Also:
setPosition(int)

finalize

protected void finalize()
                 throws java.lang.Throwable
Overrides:
finalize in class java.lang.Object