Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.ujac.chart
Class BasePieChart  view BasePieChart download BasePieChart.java

java.lang.Object
  extended byorg.ujac.chart.BaseChart
      extended byorg.ujac.chart.BasePieChart
All Implemented Interfaces:
Chart
Direct Known Subclasses:
BasePieChart3D, PieChart2D

public abstract class BasePieChart
extends BaseChart

Name: BasePieChart
Description: A base class for the rendering of pie charts.
Log: $Log: BasePieChart.java,v $
Log: Revision 1.27 2003/11/23 17:08:04 lauerc
Log: Cleaned up code.
Log:
Log: Revision 1.26 2003/11/14 12:45:48 lauerc
Log: Added shadowing support.
Log:
Log: Revision 1.25 2003/11/14 01:30:28 lauerc
Log: Added support for methods getMinValue + getMaxValue.
Log:
Log: Revision 1.24 2003/11/01 12:04:47 lauerc
Log: Added copyright notice.
Log:
Log: Revision 1.23 2003/10/31 06:28:31 lauerc
Log: Added support for attribute 'description-color'.
Log:
Log: Revision 1.22 2003/10/08 22:58:18 lauerc
Log: Reorganized chart attributes.
Log:
Log: Revision 1.21 2003/10/07 06:55:57 lauerc
Log: Added support for new attributes.
Log:
Log: Revision 1.20 2003/09/27 11:59:34 lauerc
Log: Fixed percent value calculation.
Log:
Log: Revision 1.19 2003/09/25 23:28:06 lauerc
Log: Removed attributes value-unit and display-values in favour of the more flexible attribute description-pattern.
Log:
Log: Revision 1.18 2003/09/23 07:04:35 lauerc
Log: Fixed vertical item positioning.
Log:
Log: Revision 1.17 2003/09/23 00:12:21 lauerc
Log: Fixed horizontal desccription space measurement at method drawDescription.
Log:
Log: Revision 1.16 2003/09/22 05:26:06 lauerc
Log: Considering each desription item's specific metrics now at method drawDescription.
Log:
Log: Revision 1.15 2003/09/21 12:45:21 lauerc
Log: Setting width limitations to chart description items at method drawDescription.
Log:
Log: Revision 1.14 2003/09/21 12:29:30 lauerc
Log: Drawing rounded lines to make hires charts look nicer.
Log:
Log: Revision 1.13 2003/09/21 12:12:41 lauerc
Log: Added possibility to display chart at slice descriptions.
Log:
Log: Revision 1.12 2003/09/21 10:51:03 lauerc
Log: Added support for padding attributes.
Log:
Log: Revision 1.11 2003/09/20 23:11:17 lauerc
Log: Fixed bugs in managing vertical description item positions.
Log:
Log: Revision 1.10 2003/09/20 19:49:48 lauerc
Log: Enhances description item positioning.
Log:
Log: Revision 1.9 2003/09/20 01:31:29 lauerc
Log: Fixed delta handling regarding 2D pie geometry.
Log:
Log: Revision 1.8 2003/09/20 01:13:43 lauerc
Log: Initially implemented description drawing.
Log:
Log: Revision 1.7 2003/09/19 06:56:57 lauerc
Log: Changed stroke for drowing of slices to very thin line to make high resolution output (PDF) not look ugly.
Log:
Log: Revision 1.6 2003/09/19 06:37:02 lauerc
Log: Initial revision.
Log:
Log: Revision 1.5 2003/09/19 00:10:41 lauerc
Log: Started implementation of chart description.
Log:
Log: Revision 1.4 2003/09/18 00:22:41 lauerc
Log: Changed default pie height to 10 (percent).
Log:
Log: Revision 1.3 2003/09/17 19:13:55 lauerc
Log: Changed architecture for better reusage of basic pie operations.
Log:
Log: Revision 1.2 2003/09/17 00:33:19 lauerc
Log: Added attribute 'pie-height'.
Log: Added support for method drawSliceSurface, which is performed for all slices,
Log: after the 'regular' drawing has been done.
Log:
Log: Revision 1.1 2003/09/16 22:20:20 lauerc
Log: Initial revision.
Log:

Version:
$Revision: 1.27 $

Field Summary
protected  double[] angleDiffs
          The array holding the arc differences.
static java.lang.String DEFAULT_DESCRIPTION_PATTERN
          The default description pattern.
protected  java.awt.geom.Line2D.Double[] descriptionLines
          The description line definitions.
protected  double[] endAngles
          The array holding the end angles.
protected  double[] endArcs
          The array holding the end angles.
protected  double halfPieHeight
          The half pie height.
protected  double halfPieWidth
          The half pie width.
protected  java.awt.geom.AffineTransform moveDescriptionLine
          Moves the given description line to its correct position.
protected  java.awt.geom.AffineTransform moveToCenter
          Moves the given object to the center of the pie.
protected  double[] percentages
          The array holding the percentages for the slices.
private  java.awt.Point pieCenter
          The pie center.
private  java.awt.Dimension pieSize
          The pie's size.
protected  double[] startAngles
          The array holding the start angles.
protected  double[] startArcs
          The array holding the start angles.
 
Fields inherited from class org.ujac.chart.BaseChart
attributes, DEFAULT_BORDER_WIDTH, DEFAULT_DESCRIPTION_COLOR, DEFAULT_DESCRIPTION_FONT, DEFAULT_DESCRIPTION_LINE_WIDTH, DEFAULT_PADDING, DEFAULT_PERCENT_FORMAT, DEFAULT_SHADOW_COLOR, DEFAULT_SHADOW_OFFSET, DEFAULT_TITLE_FONT, DEFAULT_VALUE_FORMAT, model
 
Fields inherited from interface org.ujac.chart.Chart
ATTR_AREA_LABELS, ATTR_BORDER_WIDTH, ATTR_DESCRIPTION_COLOR, ATTR_DESCRIPTION_FONT, ATTR_DESCRIPTION_LINE_WIDTH, ATTR_DESCRIPTION_PATTERN, ATTR_FILL_AREA, ATTR_GRID_BACKGROUND_COLOR, ATTR_GRID_COLOR, ATTR_LINE_WIDTH, ATTR_PADDING, ATTR_PADDING_BOTTOM, ATTR_PADDING_LEFT, ATTR_PADDING_RIGHT, ATTR_PADDING_TOP, ATTR_PERCENT_FORMAT, ATTR_PIE_HEIGHT, ATTR_SCALE_ARROWHEAD_LENGTH, ATTR_SCALE_ARROWHEAD_STYLE, ATTR_SCALE_ARROWHEAD_WIDTH, ATTR_SCALE_MARK_LENGTH, ATTR_SEGMENT_COLORS, ATTR_SEGMENT_LABELS, ATTR_SHADOW_COLOR, ATTR_SHADOW_OFFSET, ATTR_TITLE_FONT, ATTR_VALUE_FORMAT, ATTR_VALUE_STEP_SIZE, ATTR_VIEW_GRID, ATTR_VIEW_LEGEND, ATTR_VIEW_SCALE_ARROWS
 
Constructor Summary
BasePieChart()
           
 
Method Summary
protected  void calculateSliceMetrics(int sliceIdx, double startAngle, double endAngle)
          Calculates the metrics for the given slice
 java.awt.geom.Rectangle2D draw(java.awt.geom.Rectangle2D viewport, java.awt.Graphics2D graphics)
          Draws the chart to the given chart output.
 void drawDescription(java.awt.geom.Rectangle2D viewport, java.awt.Graphics2D graphics)
          Draws the chart description.
protected abstract  void drawSlice(java.awt.Graphics2D graphics, java.awt.Color color, int sliceIdx, int stepIdx)
          Draws a pie slice.
protected abstract  void drawSliceShadow(java.awt.Graphics2D graphics, java.awt.Color color, int sliceIdx)
          Draws the shadow of a pie slice.
protected  double getDeltaY()
          Gets the vertical delta factor for the pie height.
protected  int getDescriptionDrawingStep()
          Gets the index of the step before which to draw the chart description.
protected abstract  int getNumDrawingSteps()
          Gets the number of drawing steps to perform to draw the slices.
protected  java.awt.Point getPieCenter()
          Gets the pie center.
protected  java.awt.Dimension getPieSize()
          Gets the pie size.
protected  int getSliceHeight()
          Gets the height of the slices.
protected  void init(int numSegments)
          Initializes the data structures for the chart metrics.
 boolean supportsNegativeValues()
          Tells, whether the chart supports negative values or not.
 
Methods inherited from class org.ujac.chart.BaseChart
addAttributeDefinition, fillSupportedAttributes, getAreaLabels, getAttributes, getBorderWidth, getBottomPadding, getDescriptionColor, getDescriptionFont, getDescriptionLineWidth, getDescriptionPattern, getLeftPadding, getMaxValue, getMinValue, getModel, getPercentFormat, getRightPadding, getSegmentLabels, getShadowColor, getShadowLength, getSupportedAttributes, getTitleFont, getTopPadding, getValueFormat, setAttributes, setModel
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_DESCRIPTION_PATTERN

public static final java.lang.String DEFAULT_DESCRIPTION_PATTERN
The default description pattern.

See Also:
Constant Field Values

pieCenter

private java.awt.Point pieCenter
The pie center.


pieSize

private java.awt.Dimension pieSize
The pie's size.


halfPieWidth

protected double halfPieWidth
The half pie width.


halfPieHeight

protected double halfPieHeight
The half pie height.


percentages

protected double[] percentages
The array holding the percentages for the slices.


startAngles

protected double[] startAngles
The array holding the start angles.


endAngles

protected double[] endAngles
The array holding the end angles.


angleDiffs

protected double[] angleDiffs
The array holding the arc differences.


startArcs

protected double[] startArcs
The array holding the start angles.


endArcs

protected double[] endArcs
The array holding the end angles.


moveToCenter

protected java.awt.geom.AffineTransform moveToCenter
Moves the given object to the center of the pie.


moveDescriptionLine

protected java.awt.geom.AffineTransform moveDescriptionLine
Moves the given description line to its correct position.


descriptionLines

protected java.awt.geom.Line2D.Double[] descriptionLines
The description line definitions.

Constructor Detail

BasePieChart

public BasePieChart()
Method Detail

supportsNegativeValues

public boolean supportsNegativeValues()
Tells, whether the chart supports negative values or not.

Specified by:
supportsNegativeValues in interface Chart
Overrides:
supportsNegativeValues in class BaseChart

getPieCenter

protected java.awt.Point getPieCenter()
Gets the pie center.


getPieSize

protected java.awt.Dimension getPieSize()
Gets the pie size.


getDeltaY

protected double getDeltaY()
Gets the vertical delta factor for the pie height.


getSliceHeight

protected int getSliceHeight()
Gets the height of the slices.


draw

public java.awt.geom.Rectangle2D draw(java.awt.geom.Rectangle2D viewport,
                                      java.awt.Graphics2D graphics)
                               throws ChartException
Description copied from class: BaseChart
Draws the chart to the given chart output.

Specified by:
draw in interface Chart
Overrides:
draw in class BaseChart

init

protected void init(int numSegments)
Initializes the data structures for the chart metrics.


calculateSliceMetrics

protected void calculateSliceMetrics(int sliceIdx,
                                     double startAngle,
                                     double endAngle)
Calculates the metrics for the given slice


getNumDrawingSteps

protected abstract int getNumDrawingSteps()
Gets the number of drawing steps to perform to draw the slices.


getDescriptionDrawingStep

protected int getDescriptionDrawingStep()
Gets the index of the step before which to draw the chart description.


drawSlice

protected abstract void drawSlice(java.awt.Graphics2D graphics,
                                  java.awt.Color color,
                                  int sliceIdx,
                                  int stepIdx)
Draws a pie slice.


drawSliceShadow

protected abstract void drawSliceShadow(java.awt.Graphics2D graphics,
                                        java.awt.Color color,
                                        int sliceIdx)
Draws the shadow of a pie slice.


drawDescription

public void drawDescription(java.awt.geom.Rectangle2D viewport,
                            java.awt.Graphics2D graphics)
                     throws ChartException
Draws the chart description.