com.jinsight.jetchart
Class PieSerie

java.lang.Object
  extended bycom.jinsight.jetchart.AbstractSerie
      extended bycom.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

Field Summary
static int FOUR_COLUMNS
          Constant used to set the layout of stacked slice legends to four columns.
static int SIX_COLUMNS
          Constant used to set the layout of stacked slice legends to six columns.
static int TWO_COLUMNS
          Constant used to set the layout of stacked slice legends to two columns.
 
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 setHorizontalConnectorLength(int horizontalConnectorLength)
          Sets the length of the horizontal segments of the line that connects the middle point of a slice arc to its respective slice legend.
 void setPercentageFormat(java.lang.String percentageFormat)
          Sets the format of percentages displayed inside slice legends.
 void setSliceLegendMatchingColorEnabled(boolean isSliceLegendMatchingColorEnabled)
          Enables/disables color matching of slices and respective legends.
 void setSortedSlicesEnabled(boolean isSortedSlicesEnabled)
          Enables/disables sorted slices.
 void setStackedSliceLegendsEnabled(boolean isStackedSliceLegendsEnabled)
          Enables/disables stacked slice legends.
 void setStackedSliceLegendsGap(int stackedSliceLegendsGap)
          Sets the gap between stacked slice legends and the pie series area.
 void setStackedSliceLegendsLayout(int stackedSliceLegendsLayout)
          Sets the column layout of stacked 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
addMultipleValues, addValue, 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
 

Field Detail

TWO_COLUMNS

public static final int TWO_COLUMNS
Constant used to set the layout of stacked slice legends to two columns.

See Also:
Constant Field Values

FOUR_COLUMNS

public static final int FOUR_COLUMNS
Constant used to set the layout of stacked slice legends to four columns.

See Also:
Constant Field Values

SIX_COLUMNS

public static final int SIX_COLUMNS
Constant used to set the layout of stacked slice legends to six columns.

See Also:
Constant Field Values
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

setStackedSliceLegendsEnabled

public void setStackedSliceLegendsEnabled(boolean isStackedSliceLegendsEnabled)
Enables/disables stacked slice legends. If stacked slice legends is enabled, the slice legends are equidistantly placed along the left and right sides of the pie series area.

Parameters:
isStackedSliceLegendsEnabled - A boolean value(true/false)
See Also:
SliceLegend, setStackedSliceLegendsLayout(int)

setStackedSliceLegendsGap

public void setStackedSliceLegendsGap(int stackedSliceLegendsGap)
Sets the gap between stacked slice legends and the pie series area. The gap is 50 pixels by default.

Parameters:
stackedSliceLegendsGap - An integer number, greater than or equal to zero.
See Also:
setStackedSliceLegendsEnabled(boolean)

setStackedSliceLegendsLayout

public void setStackedSliceLegendsLayout(int stackedSliceLegendsLayout)
Sets the column layout of stacked slice legends. If the layout is set to TWO_COLUMNS, the slice legends are stacked in two columns, one to the left and other to the right, spanning across the entire available height of the chart area. Slices with the middle point located within 90 and 270 degrees have their respective legends equidistantly placed to the left, and slices with the middle point located within 270 and 360 degrees, and 0 and 90 degrees are equidistantly placed to the right.

If the layout is set to FOUR_COLUMNS, the left available height of the chart area is divided into two columns of the same height, as well as the right available height. The legends are arranged as follows:

setHorizontalConnectorLength

public void setHorizontalConnectorLength(int horizontalConnectorLength)
Sets the length of the horizontal segments of the line that connects the middle point of a slice arc to its respective slice legend. The length is 10 pixels by default.
This method only has effect if slice legends are stacked along the left and right sides of the pie chart area.

Parameters:
horizontalConnectorLength - An integer number, greater than or equal to zero.
See Also:
setStackedSliceLegendsEnabled(boolean)

setSliceLegendMatchingColorEnabled

public void setSliceLegendMatchingColorEnabled(boolean isSliceLegendMatchingColorEnabled)
Enables/disables color matching of slices and respective legends. If enabled, The background of a slice legend is painted in the same color of respective slice. Color matching is disabled by default.

Parameters:
isSliceLegendMatchingColorEnabled - A boolean value(true/false)
See Also:
Slice, SliceLegend

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)

setSortedSlicesEnabled

public void setSortedSlicesEnabled(boolean isSortedSlicesEnabled)
Enables/disables sorted slices. If enabled, slices are sorted in ascending order according to their values. This has the effect of displaying slices with smaller arcs for first, in a counterclockwise sequence starting from the zero degree position. By default, slices are not sorted.

Parameters:
isSortedSlicesEnabled - A boolean value(true/false)

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 on the image map link the user clicks on. 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.

Specified by:
getSerieMap in class 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
Throws:
java.lang.Throwable