JIDE 3.5.15

com.jidesoft.chart.model
Class LineSmoother

java.lang.Object
  extended by com.jidesoft.chart.model.LineSmoother

public class LineSmoother
extends Object

This class contains utility methods to convert a ChartModel (or arrays of point coordinates) into a GeneralPath that uses Bezier curves to connect the points.

For example, the DifferenceMarker class makes use of the methods here when its smooth property is set to true. Here are screen shots showing the 'before' and 'after' states of applying LineSmoother methods to the DifferenceMarker.

Before After
A DifferenceMarker before applying a LineSmoother The same DifferenceMarker after applying a LineSmoother


Method Summary
static GeneralPath prepareCyclicPath(Chart chart, double[] xs, double[] ys, double smoothness)
          The input points must already be cyclic, so the last x,y pair is expected to be the same as the first
static GeneralPath preparePath(Chart chart, ChartModel model, double smoothness)
          Prepares a GeneralPath in pixel coordinates as a smooth path joining the points of the model
static GeneralPath preparePath(Chart chart, ChartModel model, double smoothness, boolean reverseOrder)
          Prepares a GeneralPath in pixel coordinates as a smooth path joining the points of the model
static GeneralPath preparePath(Chart chart, double[] xPoints, double[] yPoints, double smoothness)
          Prepares a General Path that uses Bezier curves to visit the supplied points and join the curve segments smoothly
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

preparePath

public static GeneralPath preparePath(Chart chart,
                                      ChartModel model,
                                      double smoothness)
Prepares a GeneralPath in pixel coordinates as a smooth path joining the points of the model

Parameters:
chart - the chart containing the model
model - the chart model of interest
smoothness - the smoothness of the line
Returns:
a GeneralPath in pixel coordinates as a smooth path joining the points of the model

preparePath

public static GeneralPath preparePath(Chart chart,
                                      ChartModel model,
                                      double smoothness,
                                      boolean reverseOrder)
Prepares a GeneralPath in pixel coordinates as a smooth path joining the points of the model

Parameters:
chart - the chart containing the model
model - the chart model of interest
smoothness - the smoothness of the line
reverseOrder - specify whether the order of the supplied model should be reversed when generating the curve
Returns:
a GeneralPath in pixel coordinates as a smooth path joining the points of the model

prepareCyclicPath

public static GeneralPath prepareCyclicPath(Chart chart,
                                            double[] xs,
                                            double[] ys,
                                            double smoothness)
The input points must already be cyclic, so the last x,y pair is expected to be the same as the first

Parameters:
chart - the chart for which the path is being prepared
xs - an array of the x points as pixel coordinates
ys - an array of the y points as pixel coordinates
smoothness - the smoothness of the line
Returns:
a smooth cyclic path connecting all the points

preparePath

public static GeneralPath preparePath(Chart chart,
                                      double[] xPoints,
                                      double[] yPoints,
                                      double smoothness)
Prepares a General Path that uses Bezier curves to visit the supplied points and join the curve segments smoothly

Parameters:
chart - the chart for which the path is being prepared (used for checking whether points are viewable)
xPoints - an array of the xPoints as pixel coordinates
yPoints - an array of the yPoints as pixel coordinates
smoothness - the smoothness of the line joining the points
Returns:
a GeneralPath

JIDE 3.5.15