JIDE 3.5.15

com.jidesoft.chart.render
Class SmoothLineRenderer

java.lang.Object
  extended by com.jidesoft.chart.render.AbstractLineRenderer
      extended by com.jidesoft.chart.render.SmoothLineRenderer
All Implemented Interfaces:
LineRenderer, LineRenderer2D

public class SmoothLineRenderer
extends AbstractLineRenderer
implements LineRenderer2D

A renderer for drawing lines smoothly on a chart. Rather than rendering a line by drawing straight line segments to join the points of a ChartModel (like the DefaultLineRenderer), this class uses Bezier curves to join the points.


Field Summary
static String PROPERTY_CHART
           
static String PROPERTY_SMOOTHNESS
           
 
Constructor Summary
SmoothLineRenderer(Chart chart)
          Creates a DefaultLineRenderer using the supplied chart object as the chart object onto which lines should be drawn.
 
Method Summary
 void addPropertyChangeListener(PropertyChangeListener listener)
          Adds a property change listener to this object
 Chart getChart()
          Returns the chart associated with this renderer
 double getSmoothness()
          Returns the smoothness factor used in generating a curve between points
 void removePropertyChangeListener(PropertyChangeListener listener)
          Remove the supplied property change listener from this object
 Shape renderLine(Graphics2D g2d, ChartModel m, double[] xPoints, double[] yPoints, ChartStyle style)
          Render lines using the supplied arrays of x and y pixel coordinates onto the supplied Graphics context.
 Shape renderLine(Graphics g, ChartModel m, int[] xPoints, int[] yPoints, ChartStyle style)
          Render lines using the supplied arrays of x and y pixel coordinates onto the supplied Graphics context.
 void setChart(Chart chart)
          Sets the chart onto which the lines should be drawn.
 void setSmoothness(double smoothness)
          Specify the smoothness to use in generating a curve to join points.
 
Methods inherited from class com.jidesoft.chart.render.AbstractLineRenderer
calculateXHorizontalExtent, calculateYVerticalExtent, createLineFillPaint
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROPERTY_CHART

public static final String PROPERTY_CHART
See Also:
Constant Field Values

PROPERTY_SMOOTHNESS

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

SmoothLineRenderer

public SmoothLineRenderer(Chart chart)
Creates a DefaultLineRenderer using the supplied chart object as the chart object onto which lines should be drawn.

Parameters:
chart - the chart object
Method Detail

getChart

public Chart getChart()
Returns the chart associated with this renderer

Returns:
the chart object associated with this renderer

setChart

public void setChart(Chart chart)

Sets the chart onto which the lines should be drawn.

Note: The chart property is implemented as a weak reference so that it will be garbage collected when it is no longer needed. This saves you from having to call setChart(null) on this object when you have finished with the renderer.

Parameters:
chart - the Chart object

getSmoothness

public double getSmoothness()
Returns the smoothness factor used in generating a curve between points

Returns:
the smoothness factor used in generating a curve between points

setSmoothness

public void setSmoothness(double smoothness)
Specify the smoothness to use in generating a curve to join points.

Parameters:
smoothness - the smoothness factor used in generating a curve between points

addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener listener)
Adds a property change listener to this object

Parameters:
listener - a property change listener

removePropertyChangeListener

public void removePropertyChangeListener(PropertyChangeListener listener)
Remove the supplied property change listener from this object

Parameters:
listener - the property change listener to remove

renderLine

public Shape renderLine(Graphics2D g2d,
                        ChartModel m,
                        double[] xPoints,
                        double[] yPoints,
                        ChartStyle style)
Render lines using the supplied arrays of x and y pixel coordinates onto the supplied Graphics context.

Specified by:
renderLine in interface LineRenderer2D
Parameters:
g2d - the Graphics context
m - the ChartModel from which the points originated
xPoints - an array of x coordinates
yPoints - an array of y coordinates
style - the suggested style for rendering (a custom renderer may choose to ignore this)

renderLine

public Shape renderLine(Graphics g,
                        ChartModel m,
                        int[] xPoints,
                        int[] yPoints,
                        ChartStyle style)
Description copied from interface: LineRenderer
Render lines using the supplied arrays of x and y pixel coordinates onto the supplied Graphics context.

Specified by:
renderLine in interface LineRenderer
Parameters:
g - the Graphics context
m - the ChartModel from which the points originated
xPoints - an array of x coordinates
yPoints - an array of y coordinates
style - the suggested style for rendering (a custom renderer may choose to ignore this)

JIDE 3.5.15