JIDE 3.5.15

com.jidesoft.chart.render
Class AbstractPieSegmentRenderer

java.lang.Object
  extended by com.jidesoft.chart.render.AbstractRenderer
      extended by com.jidesoft.chart.render.AbstractPieSegmentRenderer
All Implemented Interfaces:
PieSegmentRenderer
Direct Known Subclasses:
DefaultPieSegmentRenderer, Pie3DRenderer, RaisedPieSegmentRenderer

public abstract class AbstractPieSegmentRenderer
extends AbstractRenderer
implements PieSegmentRenderer

The abstract pie segment renderer provides a method that renders labels that can be reused across different segment renderers.

Author:
Simon White (swhite@catalysoft.com)

Field Summary
static double maxExplode
           
static String PROPERTY_ALWAYS_SHOW_OUTLINES
           
static String PROPERTY_PIE_LABEL_RENDERER
           
static String PROPERTY_POINT_LABELER
           
static String PROPERTY_TICK_LENGTH
           
 
Fields inherited from class com.jidesoft.chart.render.AbstractRenderer
alwaysShowOutlines, PROPERTY_OUTLINE_WIDTH, ROLLOVER_INTENSITY, support
 
Constructor Summary
AbstractPieSegmentRenderer()
          Constructor.
 
Method Summary
 void clearShapes()
          Clear the cache of rendered shapes
 PointDescriptor containingSegment(Point p)
          Finds the segment of the pie chart that contains the point (x, y) if any.
protected  Paint createSegmentPaint(Chart chart, Chartable p, ChartStyle style, boolean isSelected, boolean hasRollover, Shape shape)
          You can override this method to create a custom Paint that uses the dimensions of the pie segment
 Graphics getLabelGraphics()
           
 PieLabelRenderer getPieLabelRenderer()
          Determines how to render the labels
 PointLabeler getPointLabeler()
          
 int getTickLength()
          
protected  TexturePaint modify(TexturePaint p)
           
protected  void recordSegment(Shape shape, PointDescriptor source)
           
 PointDescriptor rendered(Chartable c)
          The PointDescriptor is a representation of the point in the model
 void renderLabels(Graphics g, Chart chart, ChartModel model, Point center, int width, int height, int[] angles, ChartStyle style)
          Render the labels of the specified ChartModel on to the Chart using the given Graphics context
protected  void renderOutlines(boolean isForSelection, Graphics2D g2d, Chart chart, ChartModel model, Point center, int radius, int[] angles, ChartStyle style)
          Render the outlines of segments for a circular renderer
protected  void renderOutlines2D(boolean isForSelection, Graphics2D g2d, Chart chart, ChartModel model, Point2D center, float radius, float[] angles, ChartStyle style)
           
 void setLabelGraphics(Graphics g)
          Allow the users of the renderer to specify a different graphics context for the pie segment labels
 void setPieLabelRenderer(PieLabelRenderer newLabelRenderer)
           
 void setPointLabeler(PointLabeler pointLabeler)
          Set the point labeler, which is used to customize the strings displayed as labels
 void setTickLength(int tickLength)
          Set the length of the ticks used for each segment
 
Methods inherited from class com.jidesoft.chart.render.AbstractRenderer
addPropertyChangeListener, getOutlineColor, getOutlineWidth, getSelectionColor, isAlwaysShowOutlines, removePropertyChangeListener, setAlwaysShowOutlines, setOutlineColor, setOutlineWidth, setSelectionColor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.jidesoft.chart.render.PieSegmentRenderer
renderSegments
 

Field Detail

PROPERTY_ALWAYS_SHOW_OUTLINES

public static final String PROPERTY_ALWAYS_SHOW_OUTLINES
See Also:
Constant Field Values

PROPERTY_PIE_LABEL_RENDERER

public static final String PROPERTY_PIE_LABEL_RENDERER
See Also:
Constant Field Values

PROPERTY_POINT_LABELER

public static final String PROPERTY_POINT_LABELER
See Also:
Constant Field Values

PROPERTY_TICK_LENGTH

public static final String PROPERTY_TICK_LENGTH
See Also:
Constant Field Values

maxExplode

public static final double maxExplode
See Also:
Constant Field Values
Constructor Detail

AbstractPieSegmentRenderer

public AbstractPieSegmentRenderer()
Constructor. Switches the property alwaysShowOutlines on as a default

Method Detail

clearShapes

public void clearShapes()
Clear the cache of rendered shapes

Specified by:
clearShapes in interface PieSegmentRenderer

recordSegment

protected void recordSegment(Shape shape,
                             PointDescriptor source)

getLabelGraphics

public Graphics getLabelGraphics()

setLabelGraphics

public void setLabelGraphics(Graphics g)
Allow the users of the renderer to specify a different graphics context for the pie segment labels

Specified by:
setLabelGraphics in interface PieSegmentRenderer
Parameters:
g - the graphics context for the pie segment labels

getTickLength

public int getTickLength()

Specified by:
getTickLength in interface PieSegmentRenderer
Returns:
the tick length

setTickLength

public void setTickLength(int tickLength)
Set the length of the ticks used for each segment

Specified by:
setTickLength in interface PieSegmentRenderer
Parameters:
tickLength - the length of ticks in pixels

getPointLabeler

public PointLabeler getPointLabeler()

Specified by:
getPointLabeler in interface PieSegmentRenderer
Returns:
the point labeler

setPointLabeler

public void setPointLabeler(PointLabeler pointLabeler)
Set the point labeler, which is used to customize the strings displayed as labels

Specified by:
setPointLabeler in interface PieSegmentRenderer
Parameters:
pointLabeler - the labeler object

getPieLabelRenderer

public PieLabelRenderer getPieLabelRenderer()
Description copied from interface: PieSegmentRenderer
Determines how to render the labels

Specified by:
getPieLabelRenderer in interface PieSegmentRenderer

setPieLabelRenderer

public void setPieLabelRenderer(PieLabelRenderer newLabelRenderer)

createSegmentPaint

protected Paint createSegmentPaint(Chart chart,
                                   Chartable p,
                                   ChartStyle style,
                                   boolean isSelected,
                                   boolean hasRollover,
                                   Shape shape)
You can override this method to create a custom Paint that uses the dimensions of the pie segment


renderLabels

public void renderLabels(Graphics g,
                         Chart chart,
                         ChartModel model,
                         Point center,
                         int width,
                         int height,
                         int[] angles,
                         ChartStyle style)
Render the labels of the specified ChartModel on to the Chart using the given Graphics context


containingSegment

public PointDescriptor containingSegment(Point p)
Finds the segment of the pie chart that contains the point (x, y) if any. If none is found, the method returns null

Specified by:
containingSegment in interface PieSegmentRenderer
Parameters:
p - the point in pixel coordinates
Returns:
the chartable for the containing segment, or null if none is found.

rendered

public PointDescriptor rendered(Chartable c)
The PointDescriptor is a representation of the point in the model

Parameters:
c - the point in the model
Returns:
a description of the on-screen representation

renderOutlines

protected void renderOutlines(boolean isForSelection,
                              Graphics2D g2d,
                              Chart chart,
                              ChartModel model,
                              Point center,
                              int radius,
                              int[] angles,
                              ChartStyle style)
Render the outlines of segments for a circular renderer

Parameters:
g2d - the graphics context
chart - the chart component
model - the model for which the angles have been calculated
center - the centre of the chart
radius - the radius of the chart
angles - the consecutive (extent) angles of the segments
style - the suggested style to use for rendering the segments

renderOutlines2D

protected void renderOutlines2D(boolean isForSelection,
                                Graphics2D g2d,
                                Chart chart,
                                ChartModel model,
                                Point2D center,
                                float radius,
                                float[] angles,
                                ChartStyle style)

modify

protected TexturePaint modify(TexturePaint p)

JIDE 3.5.15