JIDE 3.5.15

com.jidesoft.chart.render
Class LinePieLabelRenderer

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

public class LinePieLabelRenderer
extends AbstractPieLabelRenderer
implements PieLabelRenderer2D

A pie label renderer that draws lines from the label to its corresponding segment in the pie chart.


Constructor Summary
LinePieLabelRenderer()
           
 
Method Summary
protected  Color createLabelColor(Chart chart, ChartModel model, Chartable p)
           
protected  Font createLabelFont(Chart chart, ChartModel model, Chartable p)
           
protected  Color createLineColor(Chart chart, ChartModel model, Chartable p)
          This method is called to determine the line color.
 int getLabelControlPointDistance()
           
 int getLabelLineGapSize()
          Returns the distance between the end of the label and the start of the line leading to the segment
 int getLabelXOffset()
           
 Color getLineColor()
          Returns the color of the line that joins the label to the pie segment
 Stroke getLineStroke()
           
 PointLabeler getPointLabeler()
          
 int getSegmentControlPointDistance()
           
 int getTickLength()
          
 boolean isShowAllLabels()
           
 void layout(List<com.jidesoft.chart.render.LinePieLabelRenderer.PieLabel> labels)
           
 void renderLabels(Graphics2D g2d, 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 setLabelControlPointDistance(int labelControlPointDistance)
           
 void setLabelLineGapSize(int labelLineGapSize)
          Specify the distance between the end of the label and the start of the line leading to the segment
 void setLabelXOffset(int labelXOffset)
          Specifies the distance that the labels are offset from the pie in the x direction
 void setLineColor(Color lineColor)
          Specify the color of the line that joins the label to the pie segment
 void setLineStroke(Stroke lineStroke)
           
 void setPointLabeler(PointLabeler pointLabeler)
          Set the object responsible for specifying what the labels should say
 void setSegmentControlPointDistance(int segmentControlPointDistance)
           
 void setShowAllLabels(boolean showAllLabels)
           
 void setTickLength(int tickLength)
          Sets the tick length used to indicate the pie segments
 
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
 

Constructor Detail

LinePieLabelRenderer

public LinePieLabelRenderer()
Method Detail

getPointLabeler

public PointLabeler getPointLabeler()

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

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:
the tick length used by this renderer

setTickLength

public void setTickLength(int tickLength)
Sets the tick length used to indicate the pie segments

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

getSegmentControlPointDistance

public int getSegmentControlPointDistance()

setSegmentControlPointDistance

public void setSegmentControlPointDistance(int segmentControlPointDistance)

getLabelControlPointDistance

public int getLabelControlPointDistance()

setLabelControlPointDistance

public void setLabelControlPointDistance(int labelControlPointDistance)

getLabelLineGapSize

public int getLabelLineGapSize()
Returns the distance between the end of the label and the start of the line leading to the segment

Returns:
the distance between the end of the label and the start of the line leading to the segment

setLabelLineGapSize

public void setLabelLineGapSize(int labelLineGapSize)
Specify the distance between the end of the label and the start of the line leading to the segment

Parameters:
labelLineGapSize - the gap in pixels between the end of the label and the start of the line pointing to the segment

getLineColor

public Color getLineColor()
Returns the color of the line that joins the label to the pie segment

Returns:
the color of the line that joins the label to the pie segment

setLineColor

public void setLineColor(Color lineColor)
Specify the color of the line that joins the label to the pie segment

Parameters:
lineColor - the color of the line that joins the label to the pie segment

createLineColor

protected Color createLineColor(Chart chart,
                                ChartModel model,
                                Chartable p)
This method is called to determine the line color. By default it just calls getLineColor() but you can override this so that it returns a different color for each segment of the pie, if required. One way of doing this is to get the highlight associated with the point and fetch the ChartStyle, so that the line color can be used.

Returns:
the Color to use

createLabelColor

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

createLabelFont

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

getLineStroke

public Stroke getLineStroke()

setLineStroke

public void setLineStroke(Stroke lineStroke)

getLabelXOffset

public int getLabelXOffset()

setLabelXOffset

public void setLabelXOffset(int labelXOffset)
Specifies the distance that the labels are offset from the pie in the x direction

Parameters:
labelXOffset - the distance in pixels

isShowAllLabels

public boolean isShowAllLabels()

setShowAllLabels

public void setShowAllLabels(boolean showAllLabels)

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 g2d,
                         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:
g2d - 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

layout

public void layout(List<com.jidesoft.chart.render.LinePieLabelRenderer.PieLabel> labels)

JIDE 3.5.15