JIDE 3.5.15

com.jidesoft.chart.render
Class SimplePieLabelRenderer

java.lang.Object
  extended by com.jidesoft.chart.render.AbstractPieLabelRenderer
      extended by com.jidesoft.chart.render.SimplePieLabelRenderer
All Implemented Interfaces:
PieLabelRenderer, PieLabelRenderer2D

public class SimplePieLabelRenderer
extends AbstractPieLabelRenderer
implements PieLabelRenderer2D

A pie label renderer that displays only the text to render the pie segment. The text may be contained in a box, for which you can specify the background colour and outline colour (if any).


Field Summary
static String PROPERTY_BACKGROUND
           
static String PROPERTY_FOREGROUND
           
static String PROPERTY_OUTLINE_COLOR
           
static String PROPERTY_POINT_LABELER
           
static String PROPERTY_RADIUS_PROPORTION
           
 
Constructor Summary
SimplePieLabelRenderer()
          Default zero-args constructor to create a SimplePieLabelRenderer
 
Method Summary
 void addPropertyChangeListener(PropertyChangeListener listener)
          Register interest in property changes
protected  Color createBackground(Chart chart, ChartModel model, Chartable p)
           
protected  Color createLabelColor(Chart chart, ChartModel model, Chartable p)
           
protected  Font createLabelFont(Chart chart, ChartModel model, Chartable p)
           
protected  Color createOutlineColor(Chart chart, ChartModel model, Chartable p)
           
 Color getBackground()
           
 Color getForeground()
          Deprecated. Use getLabelColor instead
 Color getOutlineColor()
           
 Stroke getOutlineStroke()
           
 PointLabeler getPointLabeler()
          
 double getRadiusProportion()
           
 int getTickLength()
           
 void removePropertyChangeListener(PropertyChangeListener listener)
          De-register interest in property changes
 void renderLabels(Graphics2D g, Chart chart, ChartModel model, Point2D center, double width, double height, float[] angles, ChartStyle style)
          Render the labels to the supplied graphics context
 void renderLabels(Graphics g, Chart chart, ChartModel model, Point center, int width, int height, int[] angles, ChartStyle style)
          Render the labels to the supplied graphics context
 void setBackground(Color background)
          Specify the background color used for the label.
 void setForeground(Color foreground)
          Deprecated. Use setLabelColor instead
 void setOutlineColor(Color outlineColor)
          Specify the outline color painted around the text box.
 void setOutlineStroke(Stroke outlineStroke)
           
 void setPointLabeler(PointLabeler pointLabeler)
          Set the object responsible for specifying what the labels should say
 void setRadiusProportion(double radiusProportion)
          Specify the distance of the label from the centre of the pie, as a proportion of the radius.
 void setTickLength(int tickLength)
          This label renderer does not support a tick length
 
Methods inherited from class com.jidesoft.chart.render.AbstractPieLabelRenderer
getLabelColor, getLabelFont, setLabelColor, setLabelFont
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROPERTY_RADIUS_PROPORTION

public static final String PROPERTY_RADIUS_PROPORTION
See Also:
Constant Field Values

PROPERTY_POINT_LABELER

public static final String PROPERTY_POINT_LABELER
See Also:
Constant Field Values

PROPERTY_OUTLINE_COLOR

public static final String PROPERTY_OUTLINE_COLOR
See Also:
Constant Field Values

PROPERTY_BACKGROUND

public static final String PROPERTY_BACKGROUND
See Also:
Constant Field Values

PROPERTY_FOREGROUND

public static final String PROPERTY_FOREGROUND
See Also:
Constant Field Values
Constructor Detail

SimplePieLabelRenderer

public SimplePieLabelRenderer()
Default zero-args constructor to create a SimplePieLabelRenderer

Method Detail

addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener listener)
Register interest in property changes

Parameters:
listener - the PropertyChangeListener that will receive notification

removePropertyChangeListener

public void removePropertyChangeListener(PropertyChangeListener listener)
De-register interest in property changes

Parameters:
listener - the PropertyChangeListener that will no longer receive notification

getRadiusProportion

public double getRadiusProportion()
Returns:
the location of labels as a proportion of the radius of the pie

setRadiusProportion

public void setRadiusProportion(double radiusProportion)
Specify the distance of the label from the centre of the pie, as a proportion of the radius. Therefore 0 is at the centre and 1.0 is on the circumference of the pie. The default value is 0.85.

Parameters:
radiusProportion - the location of the label as a proportion of the radius of the pie.

getPointLabeler

public PointLabeler getPointLabeler()

Specified by:
getPointLabeler in interface PieLabelRenderer
Returns:
the point labeler, which is responsible for specifying what the labels should say

getBackground

public Color getBackground()
Returns:
the background color used for the label

setBackground

public void setBackground(Color background)
Specify the background color used for the label. If set to null, no background color is used so the label is painted straight onto the chart

Parameters:
background - the new background color

createBackground

protected Color createBackground(Chart chart,
                                 ChartModel model,
                                 Chartable p)

getForeground

public Color getForeground()
Deprecated. Use getLabelColor instead

Returns the label color

Returns:
the foreground color used for the label

setForeground

public void setForeground(Color foreground)
Deprecated. Use setLabelColor instead

Specify the foreground color used for the label; that is, the color of the text. If set to null, the label will not be painted.

Parameters:
foreground - the new foreground color

createLabelColor

protected Color createLabelColor(Chart chart,
                                 ChartModel model,
                                 Chartable p)

createLabelFont

protected Font createLabelFont(Chart chart,
                               ChartModel model,
                               Chartable p)

getOutlineColor

public Color getOutlineColor()
Returns:
the outline color used for painting around the text box of a label

setOutlineColor

public void setOutlineColor(Color outlineColor)
Specify the outline color painted around the text box. If set to null, no outline will be painted

Parameters:
outlineColor - the outline color

createOutlineColor

protected Color createOutlineColor(Chart chart,
                                   ChartModel model,
                                   Chartable p)

getOutlineStroke

public Stroke getOutlineStroke()

setOutlineStroke

public void setOutlineStroke(Stroke outlineStroke)

setPointLabeler

public void setPointLabeler(PointLabeler pointLabeler)
Set the object responsible for specifying what the labels should say

Specified by:
setPointLabeler in interface PieLabelRenderer

getTickLength

public int getTickLength()
Specified by:
getTickLength in interface PieLabelRenderer
Returns:
This always returns 0

setTickLength

public void setTickLength(int tickLength)
This label renderer does not support a tick length

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

renderLabels

public void renderLabels(Graphics g,
                         Chart chart,
                         ChartModel model,
                         Point center,
                         int width,
                         int height,
                         int[] angles,
                         ChartStyle style)
Render the labels to the supplied graphics context

Specified by:
renderLabels in interface PieLabelRenderer
Parameters:
g - the graphics context
chart - the chart to render
model - the model from which the points come
center - the center of the pie
width - the width of the pie
height - the height of the pie
angles - the angles to use for the segments of the pie
style - the chart style to use for displaying the segments

renderLabels

public void renderLabels(Graphics2D g,
                         Chart chart,
                         ChartModel model,
                         Point2D center,
                         double width,
                         double height,
                         float[] angles,
                         ChartStyle style)
Description copied from interface: PieLabelRenderer2D
Render the labels to the supplied graphics context

Specified by:
renderLabels in interface PieLabelRenderer2D
Parameters:
g - the graphics context
chart - the chart to render
model - the model from which the points come
center - the center of the pie
width - the width of the pie
height - the height of the pie
angles - the angles to use for the segments of the pie
style - the chart style to use for displaying the segments

JIDE 3.5.15