JClass DesktopViews 6.3.0 API
Documentation

com.klg.jclass.chart
Class JCChartUtil

java.lang.Object
  |
  +--com.klg.jclass.util.JCNumberUtil
        |
        +--com.klg.jclass.chart.JCChartUtil

public class JCChartUtil
extends JCNumberUtil

JCChartUtil is a collection of static methods and static variables that are used throughout JClass Chart.


Field Summary
 
Fields inherited from class com.klg.jclass.util.JCNumberUtil
DECIMAL, DEFAULT_FLOAT, DEGREES, GRADS, LOG_TEN_BASE_E, M_2PI, M_PI, M_PI_2, M_SQRT2, RADIANS, XBYX1, XBYX2, XINSIDE, YBYORIGIN, YBYTOP, YINSIDE
 
Constructor Summary
JCChartUtil()
           
 
Method Summary
static com.klg.jclass.chart.DoubleCoord calcTik(double ts, int prec)
          Calculates the tick and numbering increments by taking a prospective increment size and gravitating it towards a 'nice' number, (for example, one ending in 5 or 0).
protected static double getAngleRatio(int unit, double angle, double angleOrigin, boolean clockwise)
          Calculates the fraction of a full circle that a specified angle represents.
static double getDistanceToVector(Point2D.Double endPoint1, Point2D.Double endPoint2, Point2D.Double point)
          Returns the minimum pixel distance between a pick point and a specified line segment.
static Line2D.Double[] getLineSegments(Polygon poly)
          Creates an array of line segments from the vertex coordinates of the specified polygon.
static double getPolygonDistance(int px, int py, Polygon poly)
          Returns the minimum pixel distance between a pick point and a specified polygon.
static double getRadarAngle(int angleUnits, int numberPoints, int index, boolean isReversed)
          Returns the radar angle for a data point.
static double getShapeDistance(Point2D.Double pt, Shape shape, double flatness)
          Returns the minimum pixel distance between a pick point and a specified Shape object.
 
Methods inherited from class com.klg.jclass.util.JCNumberUtil
abs, abs, boundAngle, brighter, calcError, clamp, clamp, clamp, colorsNear, convertAngle, convertFromSN, countInString, darker, degToRad, distance, distance, distance, distTrap, fmod, format, fudgeItalicLabel, getDecimalPointChar, iceil, ifloor, internalFormat, intLog10, isHTML, locateX, locateXY, locateY, log10, logFormat, max, min, nicePrecision, pointsToPolygon, pow10, precCeil, precCorrect, precFloor, radToDeg, tickBasedPrecision, trace, validUnit
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JCChartUtil

public JCChartUtil()
Method Detail

getLineSegments

public static Line2D.Double[] getLineSegments(Polygon poly)
Creates an array of line segments from the vertex coordinates of the specified polygon.

Parameters:
poly - the polygon
Returns:
array of line segments

getPolygonDistance

public static double getPolygonDistance(int px,
                                        int py,
                                        Polygon poly)
Returns the minimum pixel distance between a pick point and a specified polygon. If the pick point is inside the polygon, the return value is 0.

Parameters:
px - the x pixel coordinate of the pick point
py - the y pixel coordinate of the pick point
poly - the Polygon
Returns:
the pixel distance of the pick point from the polygon

getShapeDistance

public static double getShapeDistance(Point2D.Double pt,
                                      Shape shape,
                                      double flatness)
Returns the minimum pixel distance between a pick point and a specified Shape object. If the pick point is inside the Shape, the return value is 0.

Parameters:
pt - the pick point
shape - the Shape
flatness - the maximum distance, from any point on the original curve, that the line segments which are used to approximate curved segments are allowed to deviate
Returns:
the pixel distance of the pick point from the Shape

getDistanceToVector

public static double getDistanceToVector(Point2D.Double endPoint1,
                                         Point2D.Double endPoint2,
                                         Point2D.Double point)
Returns the minimum pixel distance between a pick point and a specified line segment.

Parameters:
endPoint1 - first point of line segment
endPoint2 - last point of line segment
point - the pick point
Returns:
pixel distance

calcTik

public static com.klg.jclass.chart.DoubleCoord calcTik(double ts,
                                                       int prec)
Calculates the tick and numbering increments by taking a prospective increment size and gravitating it towards a 'nice' number, (for example, one ending in 5 or 0).

Parameters:
ts -
prec -
Returns:

getRadarAngle

public static double getRadarAngle(int angleUnits,
                                   int numberPoints,
                                   int index,
                                   boolean isReversed)
Returns the radar angle for a data point.

Parameters:
angleUnits - either DEGREES, GRADS, or RADIANS
numberPoints - number of spokes in Radar chart
index - array index of data point
isReversed - true if the direction of the angle axis is reversed
Returns:
The radar angle of the specified data point. The returned value does not include the origin base.

getAngleRatio

protected static double getAngleRatio(int unit,
                                      double angle,
                                      double angleOrigin,
                                      boolean clockwise)
Calculates the fraction of a full circle that a specified angle represents.

Parameters:
unit - The units in which the angle is expressed. Valid values are JCChartUtil.DEGREES, JCChartUtil.GRADS, or JCChartUtil.RADIANS.
angle - the angle for which the angle ratio is to be calculated
angleOrigin - the angle offset for the chart
clockwise - true if the angle values increase in the clockwise direction
Returns:
the angle ratio

Copyright © 2004 Quest Software Inc..
All rights reserved.