net.sourceforge.chart2d
Class PieArea

java.lang.Object
  |
  +--net.sourceforge.chart2d.Area
        |
        +--net.sourceforge.chart2d.PieArea

class PieArea
extends Area

A container for many variables and components relating to a pie area. A pie area is the area that contains only the pie of a pie chart. It doesn't have a legend.
Features:
Allows for charting both floats and int values. Works fine even if all values are zero. Does not accept negative values. Outputs center points of sectors so that labels can be drawn into the sectors, touching these points. Outpouts how many sectors are in each quarter of the pie, so that appropriate placement of labels can be decided. The first datum in the data set will be the first sector beginning from the angle of 135 degrees and ending somewhere clockwise to it It will have the first color in the colors set. The remaining sectors are laid out similarly, clockwise.


Fields inherited from class net.sourceforge.chart2d.Area
BETWEEN, BOTTOM, CENTER, CENTERED, CONTINUOUS, DASHED, DOTTED, FLOAT, HEIGHT, HORIZONTAL, INTEGER, LABELSBOTTOM, LABELSLEFT, LEFT, LEFTBOTTOM, LEFTRIGHT, LEFTTOP, LESSER, MAX, MAXMODEL, MIN, RIGHT, RIGHTBOTTOM, RIGHTTOP, TOP, TOPBOTTOM, VERTICAL, WIDTH
 
Constructor Summary
(package private) PieArea()
          Creates a pie area with the default values.
 
Method Summary
(package private)  java.awt.Color[] getColors()
          Returns this property.
(package private)  float[] getDataSet()
          Returns the raw numbers to represent by the pie.
(package private)  int getNumSectors()
          Returns this property.
(package private)  int[] getNumSectorsInQuarters()
          Returns this property.
(package private)  boolean getOutlineSectors()
          Returns whether the sectors should have a thin outline.
(package private)  java.awt.Color getOutlineSectorsColor()
          Returns the color of the sectors outline if it exists.
(package private)  boolean getPieAreaNeedsUpdate()
          Indicates whether some property of this class has changed.
(package private)  java.awt.Point[] getPointsInSectors()
          Returns a point in each sector at the depth specified by setSectorsPointDepthRatio(float).
(package private)  java.awt.Point[] getPointsOutSectors()
          Returns a point in out of each sector at the location indicated by setSectorsPointExternalRatio(float).
(package private)  float getSectorPointDepthRatio()
          Returns how far into the sector the depth of the points from the getPointsInSectors() method are.
(package private)  void paintComponent(java.awt.Graphics2D g2D)
          Paints all the components of this class.
(package private)  void resetPieAreaModel(boolean reset)
          Resets the model for this class.
(package private)  void setColors(java.awt.Color[] colors)
          For input of the color of each sector that represents a datum of the data set.
(package private)  void setCustomSpaceSize(boolean customize, java.awt.Dimension size)
          Sets the "minimum" size of the pie directly.
(package private)  void setDataSet(float[] values)
          For input of the raw numbers to represent by the pie.
(package private)  void setOutlineSectors(boolean outline)
          Indicates whether the sectors should have a thin outline.
(package private)  void setOutlineSectorsColor(java.awt.Color color)
          Indicates the color of the sectors outline if it exists.
(package private)  void setPiePrefSpaceSize(int size)
          Sets the model size of the pie.
(package private)  void setSectorGapPointRatio(float ratio)
          Determines how far out of the sector the points from the getPointsOutSectors() method are.
(package private)  void setSectorPointDepthRatio(float ratio)
          Determines how far into the sector the depth of the points from the getPointsInSectors() method are.
(package private)  void updatePieArea()
          Updates this parent's variables, and this' variables.
 
Methods inherited from class net.sourceforge.chart2d.Area
applyRatio, getAreaNeedsUpdate, getAutoSize, getBackgroundColor, getBackgroundExistence, getBorderColor, getBorderColor, getBorderExistence, getBorderExistence, getBorderThickness, getBorderThickness, getBorderThicknessModel, getBorderThicknessModel, getGapThickness, getGapThicknessModel, getJustifications, getRatio, getResetAreaModel, getSize, getSizeLocation, getSpaceSize, getSpaceSizeLocation, resetAreaModel, setAutoJustifys, setAutoSizes, setBackgroundColor, setBackgroundExistence, setBorderAssociations, setBorderColor, setBorderColors, setBorderCornerAssociations, setBorderExistence, setBorderExistences, setBorderThicknessModel, setBorderThicknessModels, setCustomRatio, setGapAssociations, setGapExistence, setGapExistences, setGapThicknessModel, setGapThicknessModels, setJustifications, setLockRatios, setSize, setSizeLocation, setSpaceSize, setSpaceSizeLocation, updateArea
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PieArea

PieArea()
Creates a pie area with the default values.
Method Detail

setOutlineSectors

void setOutlineSectors(boolean outline)
Indicates whether the sectors should have a thin outline.
Parameters:
outline - If true, then the outline exists.

setOutlineSectorsColor

void setOutlineSectorsColor(java.awt.Color color)
Indicates the color of the sectors outline if it exists.
Parameters:
color - The color for the outline.

getOutlineSectors

boolean getOutlineSectors()
Returns whether the sectors should have a thin outline.
Returns:
outline If true, then the outline exists.

getOutlineSectorsColor

java.awt.Color getOutlineSectorsColor()
Returns the color of the sectors outline if it exists.
Returns:
color The color for the outline.

setSectorPointDepthRatio

void setSectorPointDepthRatio(float ratio)
Determines how far into the sector the depth of the points from the getPointsInSectors() method are.
Parameters:
ratio - The ratio on the radius of the circle.

setSectorGapPointRatio

void setSectorGapPointRatio(float ratio)
Determines how far out of the sector the points from the getPointsOutSectors() method are.
Parameters:
ratio - The ratio on the radius of the circle.

setDataSet

void setDataSet(float[] values)
For input of the raw numbers to represent by the pie. Array element i is sector i, clockwise from degree 135.
Parameters:
values - The raw numbers to represent by the pie.

setColors

void setColors(java.awt.Color[] colors)
For input of the color of each sector that represents a datum of the data set. Array element i is sector i, clockise from degree 135.
Parameters:
colors - The colors of the sectors.

setPiePrefSpaceSize

void setPiePrefSpaceSize(int size)
Sets the model size of the pie. When initially drawn, the pie will be at least this size, if this size is less than the max space size of this area. After that and if magnificying, the pie size will be applied to the size ratios.
Parameters:
size - The model size of the pie.

setCustomSpaceSize

void setCustomSpaceSize(boolean customize,
                        java.awt.Dimension size)
Sets the "minimum" size of the pie directly. If the minimum is too large, then the size will be the pie's maximum size.
Parameters:
size - The number to multiply to get the minimum size.

getDataSet

float[] getDataSet()
Returns the raw numbers to represent by the pie.
Returns:
The raw numbers to represent by the pie.

getColors

java.awt.Color[] getColors()
Returns this property.
Returns:
The colors of the lines.

getNumSectors

int getNumSectors()
Returns this property.
Returns:
The number of sectors in this pie.

getNumSectorsInQuarters

int[] getNumSectorsInQuarters()
Returns this property. This property allows figuring out where to place labels if one wants to label this pie, more than is provided by the legend in PieChartArea. One can use a HorizontalTextListArea for the TOP and BOTTOM labels; and a VerticalTextListArea for the LEFT and RIGHT labels. This information helps them figure out how many and which labels belong in each text list.
Returns:
The number of sectors in the quarters. Actually, the number of center points of sectors in this quarter. Quarters are defined as follows: TOP = 135 to 45, LEFT = 45 to 315, BOTTOM = 315 to 225, RIGHT = 225 to 135.

getSectorPointDepthRatio

float getSectorPointDepthRatio()
Returns how far into the sector the depth of the points from the getPointsInSectors() method are.
Returns:
The ratio on the radius of the circle.

getPointsInSectors

java.awt.Point[] getPointsInSectors()
Returns a point in each sector at the depth specified by setSectorsPointDepthRatio(float).
Returns:
Point[] The points inside the sectors.

getPointsOutSectors

java.awt.Point[] getPointsOutSectors()
Returns a point in out of each sector at the location indicated by setSectorsPointExternalRatio(float).
Returns:
Point[] The points outside the sectors.

resetPieAreaModel

void resetPieAreaModel(boolean reset)
Resets the model for this class. The model is used for shrinking and growing of its components based on the maximum size of this class. If this method is called, then the next time the maximum size is set, this classes model maximum size will be made equal to the new maximum size. Effectively what this does is ensure that whenever this objects maximum size is equal to the one given, then all of the components will take on their default model sizes. Note: This is only useful when auto model max sizing is disabled.
Parameters:
reset - True causes the max model size to be set upon the next max sizing.

getPieAreaNeedsUpdate

boolean getPieAreaNeedsUpdate()
Indicates whether some property of this class has changed.
Returns:
True if some property has changed.

updatePieArea

void updatePieArea()
Updates this parent's variables, and this' variables.

paintComponent

void paintComponent(java.awt.Graphics2D g2D)
Paints all the components of this class. First all variables are updated.
Overrides:
paintComponent in class Area
Parameters:
g2D - The graphics context for calculations and painting.