|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.ujac.chart.BaseChart org.ujac.chart.BasePieChart
public abstract class BasePieChart
Name: BasePieChart
Description: A base class for the rendering of pie charts.
Field Summary | |
---|---|
protected double[] |
angleDiffs
The array holding the arc differences. |
static String |
DEFAULT_DESCRIPTION_PATTERN
The default description pattern. |
static float |
DEFAULT_PIE_DESCRIPTION_ANCHOR_RATIO
The default pie description anchor ratio. |
static float |
DEFAULT_PIE_DESCRIPTION_BASELINE_RATIO
The default pie description anchor ratio. |
static int |
DEFAULT_PIE_DESCRIPTION_LAYOUT
The default pie description layout mode. |
protected 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 AffineTransform |
moveDescriptionLine
Moves the given description line to its correct position. |
protected AffineTransform |
moveToCenter
Moves the given object to the center of the pie. |
protected double[] |
percentages
The array holding the percentages for the slices. |
static int |
PIE_DESCRIPTION_LAYOUT_BORDER
Constant for border aligned pie description layout mode. |
static int |
PIE_DESCRIPTION_LAYOUT_ROUND
Constant for round pie description layout mode. |
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_SHADOW_COLOR, DEFAULT_SHADOW_OFFSET, DEFAULT_TITLE_FONT, defaultPercentFormat, defaultValueFormat, model |
Constructor Summary | |
---|---|
BasePieChart()
|
Method Summary | |
---|---|
protected void |
calculateSliceMetrics(int sliceIdx,
double startAngle,
double endAngle)
Calculates the metrics for the given slice |
Rectangle2D |
draw(Rectangle2D viewport,
Graphics2D graphics)
Draws the chart to the given chart output. |
void |
drawDescription(Rectangle2D viewport,
Graphics2D graphics)
Draws the chart description. |
protected abstract void |
drawSlice(Graphics2D graphics,
Color color,
int sliceIdx,
int stepIdx)
Draws a pie slice. |
protected abstract void |
drawSliceShadow(Graphics2D graphics,
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 Point |
getPieCenter()
Gets the pie center. |
float |
getPieDescriptionAnchorRatio()
Gets the border width. |
float |
getPieDescriptionBaselineRatio()
Gets the border width. |
int |
getPieDescriptionLayout()
Gets the number format for value output. |
protected 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 java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String DEFAULT_DESCRIPTION_PATTERN
public static final int PIE_DESCRIPTION_LAYOUT_BORDER
public static final int PIE_DESCRIPTION_LAYOUT_ROUND
public static final int DEFAULT_PIE_DESCRIPTION_LAYOUT
public static final float DEFAULT_PIE_DESCRIPTION_ANCHOR_RATIO
public static final float DEFAULT_PIE_DESCRIPTION_BASELINE_RATIO
protected double halfPieWidth
protected double halfPieHeight
protected double[] percentages
protected double[] startAngles
protected double[] endAngles
protected double[] angleDiffs
protected double[] startArcs
protected double[] endArcs
protected AffineTransform moveToCenter
protected AffineTransform moveDescriptionLine
protected Line2D.Double[] descriptionLines
Constructor Detail |
---|
public BasePieChart()
Method Detail |
---|
public boolean supportsNegativeValues()
supportsNegativeValues
in interface Chart
supportsNegativeValues
in class BaseChart
public int getPieDescriptionLayout()
public float getPieDescriptionAnchorRatio()
public float getPieDescriptionBaselineRatio()
protected Point getPieCenter()
protected Dimension getPieSize()
protected double getDeltaY()
protected int getSliceHeight()
public Rectangle2D draw(Rectangle2D viewport, Graphics2D graphics) throws ChartException
BaseChart
draw
in interface Chart
draw
in class BaseChart
viewport
- The viewport for chart output.graphics
- The graphics object used for chart output.
ChartException
- In case the rendering failed.BaseChart.draw(java.awt.geom.Rectangle2D, java.awt.Graphics2D)
protected void init(int numSegments)
numSegments
- The number of metrics for which toprotected void calculateSliceMetrics(int sliceIdx, double startAngle, double endAngle)
sliceIdx
- The index of the slice to calculate.startAngle
- The start angle in degrees.endAngle
- The end angle in degrees.protected abstract int getNumDrawingSteps()
protected int getDescriptionDrawingStep()
protected abstract void drawSlice(Graphics2D graphics, Color color, int sliceIdx, int stepIdx)
graphics
- The graphics object to draw width.color
- The slice's color.sliceIdx
- The index of the slice to draw.stepIdx
- The index of the drawing step to perform.protected abstract void drawSliceShadow(Graphics2D graphics, Color color, int sliceIdx)
graphics
- The graphics object to draw width.color
- The slice's color.sliceIdx
- The index of the slice to draw.public void drawDescription(Rectangle2D viewport, Graphics2D graphics) throws ChartException
viewport
- The viewport for chart output.graphics
- The graphics object used for chart output.
ChartException
- In case the rendering failed.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |