com.jinsight.jetchart
Class Slice

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

public class Slice
extends java.lang.Object

This class implements the properties and methods of pie series slices. A Slice object is associated with a single value. Each slice angle is proportional to the value it represents, and the sum of all slices values is equivalent to a 360 degrees angle. The default value is zero.

See Also:
PieSerie

Constructor Summary
Slice()
          Default constructor of a Slice object.
Slice(double value)
          Constructor of a Slice object.
Slice(double value, java.lang.String title, java.awt.Color color)
          Constructor of a Slice object.
 
Method Summary
protected  void finalize()
           
 java.awt.Color getColor()
          Returns slice color.
 int getIndex()
          Returns slice index.
 SliceLegend getSliceLegend()
          Returns a reference to a SliceLegend object.
 double getValue()
          Returns the Slice object value.
 void setColor(java.awt.Color color)
          Sets slice color.
 void setPosition(int position)
          Sets slice position.
 void setTitle(java.lang.String title)
          Sets slice title.
 void setValue(double value)
          Sets slice value.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Slice

public Slice()
Default constructor of a Slice object.

Slice

public Slice(double value)
Constructor of a Slice object.
Parameters:
value - A double precision number

Slice

public Slice(double value,
             java.lang.String title,
             java.awt.Color color)
Constructor of a Slice object.
Parameters:
value - A double precision number
title - The slice title as a String object
color - The slice color as a Color object. Default color is Color.lightGray.
Method Detail

setValue

public void setValue(double value)
Sets slice value.
Parameters:
value - A double precision number

setTitle

public void setTitle(java.lang.String title)
Sets slice title.
Parameters:
title - A String object

setColor

public void setColor(java.awt.Color color)
Sets slice color. Default slice color is Color.lightGray.
Parameters:
color - A Color object.

setPosition

public void setPosition(int position)
Sets slice position. If a number greater than zero is informed, slice is exploded.
Parameters:
position - An integer number equal to or greater than zero.

getSliceLegend

public SliceLegend getSliceLegend()
Returns a reference to a SliceLegend object. Each Slice object owns a SliceLegend object.
Returns:
A SliceLegend object.
See Also:
SliceLegend

getColor

public java.awt.Color getColor()
Returns slice color.
Returns:
A Color object

getIndex

public int getIndex()
Returns slice index. If a slice was not added to a PieSerie object, this method returns -1.
Returns:
An integer number

getValue

public double getValue()
Returns the Slice object value.
Returns:
A double precision number.

finalize

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