com.jinsight.jetchart
Class PieSerie

java.lang.Object
  |
  +--com.jinsight.jetchart.AbstractSerie
        |
        +--com.jinsight.jetchart.PieSerie

public class PieSerie
extends AbstractSerie

This class paints a pie series. A pie series is made up of a sequence of slices disposed counterclockwise. Each slice is an object whose properties can be individually configured. Three basic steps must be taken in order to create a pie series:

  1. Create the chart context
  2. Create a pie series and add it to the chart context
  3. Create as many slices objects as necessary and add them to the pie series object.

See Also:
PieGraph, Slice

Fields inherited from class com.jinsight.jetchart.AbstractSerie
CLIENT_SIDE, SERVER_SIDE_CERN, SERVER_SIDE_NCSA
 
Constructor Summary
PieSerie()
          Default constructor.
 
Method Summary
 void addSlice(Slice slice)
          Adds a Slice object to a pie series.
protected  void finalize()
           
 java.lang.String getSerieMap(java.lang.String[] urls, int type, java.lang.String target)
          Creates a chart image map.
 java.lang.String getSerieMap(java.lang.String[] urls, java.lang.String target, boolean addLabels)
           
 java.lang.String getSerieMap(java.lang.String[] urls, java.lang.String target, java.lang.String[] labels)
           
 Slice getSlice(int index)
          Returns a Slice object, given its index number.
 Slice getSlice(int x, int y)
          Returns a Slice object, given its x,y coordinates.
 java.util.Vector getSlices()
          Returns an array with references to all Slice objects.
 void removeAllSlices()
          Removes all Slice objects from a pie series.
 void removeSlice(Slice slice)
          Removes a Slice object from a pie series.
 void set3DDepth(int pieDepth)
          Sets 3D depth.
 void setAngleOffset(int offset)
          Sets the angle offset of each Slice object.
 void setBorderEnabled(boolean hasBorder)
          Enables/disables a border around pie chart slices.
 void setCircledEnabled(boolean isCircled)
          Enables/disables circular pie charts.
 void setPercentageFormat(java.lang.String percentageFormat)
          Sets the format of percentages displayed inside slice legends.
 void setXRadiusInset(int xRadiusInset)
          Sets an inset to be added to the left and right pie chart margins.
 void setYRadiusInset(int yRadiusInset)
          Sets an inset to be added to the top and bottom pie chart margins.
 
Methods inherited from class com.jinsight.jetchart.AbstractSerie
getId, getMultipleValues, getValues, setHighlightColor, setHighlightEnabled, setId, setLegendEnabled, setMultipleValues, setMultipleValues, setSVGURLs, setToolTipContent, setToolTipEnabled, setValueFormat, setValues, setValues, setValuesQuery
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PieSerie

public PieSerie()
Default constructor. Creates a PieSerie object.
Method Detail

addSlice

public void addSlice(Slice slice)
Adds a Slice object to a pie series.
Parameters:
slice - A Slice object.
See Also:
Slice

removeSlice

public void removeSlice(Slice slice)
Removes a Slice object from a pie series.
Parameters:
slice - A Slice object.
See Also:
Slice

removeAllSlices

public void removeAllSlices()
Removes all Slice objects from a pie series.
See Also:
Slice

getSlices

public java.util.Vector getSlices()
Returns an array with references to all Slice objects.
Returns:
Array of Slice objects.
See Also:
Slice

setXRadiusInset

public void setXRadiusInset(int xRadiusInset)
Sets an inset to be added to the left and right pie chart margins.
Parameters:
xRadiusInset - An integer number representing the left and right insets, in pixels.

setYRadiusInset

public void setYRadiusInset(int yRadiusInset)
Sets an inset to be added to the top and bottom pie chart margins.
Parameters:
yRadiusInset - An integer number representing the top and bottom insets, in pixels.

setCircledEnabled

public void setCircledEnabled(boolean isCircled)
Enables/disables circular pie charts. If disabled, a pie chart can have an elliptical shape.
Parameters:
isCircled - A boolean value(true/false).

setBorderEnabled

public void setBorderEnabled(boolean hasBorder)
Enables/disables a border around pie chart slices.
Parameters:
hasBorder - A boolean value(true/false).

setPercentageFormat

public void setPercentageFormat(java.lang.String percentageFormat)
Sets the format of percentages displayed inside slice legends. If a percentage format is set, a NumberFormat object is created and, if possible, cast to a DecimalFormat instance. The percentage value is then applied a format compatible with valid patterns of the DecimalFormat class.
Parameters:
percentageFormat - A String object

setAngleOffset

public void setAngleOffset(int offset)
Sets the angle offset of each Slice object. Slices are by default painted counterclockwise and beginning in a zero degree angle inside the pie chart area. The angle offset increments the starting angle, rotating the chart.
Parameters:
offset - An integer number representing an angle offset.

set3DDepth

public void set3DDepth(int pieDepth)
Sets 3D depth. Only has effect if 3D chart is enabled.
Parameters:
pieDepth - An integer number representing pie depth, in pixels.
See Also:
GenericGraph.set3DEnabled(boolean)

getSlice

public final Slice getSlice(int x,
                            int y)
Returns a Slice object, given its x,y coordinates. If the coordinates are not inside a slice area, this method returns null.
Returns:
A Slice object.
See Also:
Slice, SerieEvent, SerieListener

getSlice

public Slice getSlice(int index)
Returns a Slice object, given its index number. Slices are painted sequentially counterclockwise and are indexed in this order, from 0 to the maximum number of slices minus 1.
Parameters:
index - An integer number representing the slice index.
See Also:
Slice

getSerieMap

public java.lang.String getSerieMap(java.lang.String[] urls,
                                    int type,
                                    java.lang.String target)
Description copied from class: AbstractSerie
Creates a chart image map. A image map is used in an HTML document to allow regions of an image to be linked to other HTML documents. The web browser will bring up a different document depending where on the image map the user clicks. The map itself is either a separate file (server-side maps) or part of the HTML document (client-side maps).
A client-side map can be inserted into html text to be returned by a servlet that also generates the chart image.
If the 'urls' parameter is informed, data points coordinates are associated with each element found in the array of urls. If hyperlinks are not required set the 'urls' parameter to null.
The second parameter sets the map format type. Image map can be generated in three different formats. A client-side map and an NCSA server or CERN server formatted map. The client-side map is the most used format.
The third parameter sets a target. The target is the name of an html frame used to display the page associated with the image map. This parameter is only related to client-side image mapping. If a target frame is not required set the 'target' parameter to null.
Overrides:
getSerieMap in class AbstractSerie
Following copied from class: com.jinsight.jetchart.AbstractSerie
Parameters:
urls - An array of strings containing valid urls.
type - An integer representing the format type.
target - A string object.
See Also:
AbstractSerie.CLIENT_SIDE, AbstractSerie.SERVER_SIDE_NCSA, AbstractSerie.SERVER_SIDE_CERN

getSerieMap

public java.lang.String getSerieMap(java.lang.String[] urls,
                                    java.lang.String target,
                                    boolean addLabels)

getSerieMap

public java.lang.String getSerieMap(java.lang.String[] urls,
                                    java.lang.String target,
                                    java.lang.String[] labels)

finalize

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