|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.quinncurtis.chart2djava.ChartObj
com.quinncurtis.chart2djava.ChartSupport
public class ChartSupport
This class provides support utilities.
Field Summary |
---|
Constructor Summary | |
---|---|
ChartSupport()
|
Method Summary | |
---|---|
static int |
adjustDecs(double r,
int decs)
This method adjusts the number of digits to the right of the decimal used to display axis labels. |
static double |
antilog10Ex(double r)
Converts a number to its anti log base 10 value. |
static boolean |
bGoodValue(ChartPoint2D p)
This method returns true if either the x or y value of a coordinate is equal to the designate bad value number, rBadDataValue. |
static boolean |
bGoodValue(double x)
Returns true if a value does not equal the designated bad data value. |
static boolean |
bGoodValue(double x,
double y)
This method returns true if either the x or y value of a coordinate is equal to the designate bad value number, rBadDataValue. |
static boolean |
bGoodValue(double x1,
double y1,
double z1)
This method returns true if either the x, y or z value of a coordinate is equal to the designate bad value number, rBadDataValue. |
static boolean |
bGoodValue(double x1,
double y1,
double x2,
double y2)
This method returns true if the end points of a line segment have coordinate values equal to the designate bad value number, rBadDataValue. |
static boolean |
calcNearestPoint(PhysicalCoordinates transform,
GroupDataset dataset,
boolean coordswap,
ChartPoint2D testpoint,
int nmode,
NearestPointData nearestpoint)
This method compares a test point against all of the xy points in a simple dataset and calculates which point in the dataset is nearest the test point. |
static boolean |
calcNearestPoint(PhysicalCoordinates transform,
SimpleDataset dataset,
boolean coordswap,
ChartPoint2D testpoint,
int nmode,
NearestPointData nearestpoint)
This method compares a test point against all of the xy points in a simple dataset and calculates which point in the dataset is nearest the test point. |
static int |
clampInt(int i,
int lowvalue1,
int highvalue1)
This method checks and limits the range of the input variable, preventing wild numeric overflows from propagating. |
static double |
clampReal(double r,
double lowvalue1,
double highvalue1)
This method checks and limits the range of the input variable, preventing wild numeric overflows from propagating. |
static ChartPoint3D |
clampToViewCoordinates(ChartPoint3D p)
|
static double |
clampToViewCoordinates(double r)
This method checks and limits the range of the input value from exceeding the value of +- USER_COORD_MAX. |
java.lang.Object |
clone()
Returns an object that is a clone of this object. |
static int |
findRelatedAxisLabels(int index,
java.util.Vector<GraphObj> source)
This method returns the index of the AxisLabels object embedded in the specified Axis object. |
static int |
findRelatedAxisTitleAxis(int index,
java.util.Vector<GraphObj> source)
This method returns the index of the Axis object embedded in the specified AxisTitle object. |
static int |
findRelatedGridAxes(int index,
java.util.Vector<GraphObj> source,
java.awt.Dimension axesresults)
This method returns the indices of the Axis objects embedded in the specified Grid object. |
static int |
findRelatedPolarAxesLabels(int index,
java.util.Vector<GraphObj> source)
This method returns the index of the PolarAxesLabels object embedded in the specified PolarAxes object. |
static void |
fixCommonRangeError(ChartRectangle2D rect,
double typicalmin,
double typicalmax)
This method checks and repairs common errors in specifying range limits for graphs. |
static double[] |
floatToDoubleArray(float[] floatarray)
This method will convert a double array to a float array, for those who have arrays of data in float format. |
static java.awt.Color |
fromArgb(int alpha,
int r,
int g,
int b)
This method returns a color with the specified component values. |
static int |
getCoordinateSystemType(PhysicalCoordinates transform)
This method returns POLAR_POS if the coordinate system is of type PolarCoordinates, otherwise it returns PHYS_POS. |
static double |
getDatasetsMax(ChartDataset[] datasets,
int numdatasets,
int naxis)
This static method returns the maximum value in an array of SimpleDataset objects. |
static double |
getDatasetsMin(ChartDataset[] datasets,
int numdatasets,
int naxis)
This static method returns the minimum value in an array of SimpleDataset objects. |
static double |
getDatasetsSumMax(GroupDataset[] datasets,
int numdatasets,
int naxis)
This method is used by the auto-scale routines to determine the maximum scale value for "stacked" graphs that use group data. |
static double |
getDatasetsSumMin(GroupDataset[] datasets,
int numdatasets,
int naxis)
This method is used by the auto-scale routines to determine the minimum scale value for "stacked" graphs that use group data. |
static int |
getFirstValidIndex(boolean[] valid,
int n)
This method returns index of the first valid point in an array of ChartPoint2D points. |
static int |
getFirstValidIndex(ChartPoint2D[] p,
int n)
This method returns index of the first valid point in an array of ChartPoint2D points. |
static int |
getFirstValidIndex(double[] x,
double[] y,
int n)
This method returns index of the first valid xy value pair in a pair of x and y- coordinate arrays. |
static int |
getFirstValidIndex(double[] r,
int n)
This method returns index of the first valid value in an array. |
static double |
getFirstValidValue(double[] r,
int n)
This method returns the first valid value in an array. |
static double |
getMaximum(double[] rbuffer)
This method returns the maximum value in an array. |
static double |
getMaximum(DoubleArray r)
This method returns the maximum value in an array. |
static double |
getMaximum(DoubleArray2D rc,
BoolArray valid,
int ngroup)
This method returns the maximum value in a 2D array. |
static double |
getMaximum(DoubleArray r,
BoolArray valid)
This method returns the maximum value in an array. |
static double |
getMinimum(double[] rbuffer)
This method returns the minimum value in an array. |
static double |
getMinimum(DoubleArray r)
This method returns the minimum value in an array. |
static double |
getMinimum(DoubleArray2D rc,
BoolArray valid,
int ngroup)
This method returns the minimum value in a 2D array. |
static double |
getMinimum(DoubleArray r,
BoolArray valid)
This method returns the minimum value in an array. |
static int |
getNumColumns(double[][] y)
This method returns the number of columns in a 2D double array. |
static int |
getNumColumns(java.util.GregorianCalendar[][] y)
This method returns the number of columns in a 2D GregorianCalendar array. |
static double |
getRandomDouble()
This method returns a random value in the range 0.0 to 1.0. |
static boolean |
isKindOf(java.lang.Object obj,
java.lang.String typestring)
This method checks to see if an object is of a specific com.quinncurtis.chart2dnet class type. |
static boolean |
isKindOf(java.lang.Object obj,
java.lang.String typestring,
boolean appendqc)
This method checks to see if an object is of a specific com.quinncurtis.chart2dnet class type. |
static boolean |
isStackedPlotType(ChartPlot plotobj)
This method returns true if a plot object is one of the stacked (STACKEDBAR or STACKEDLINE) chart types. |
static boolean |
isType(java.lang.Object obj,
java.lang.String typestring)
This method checks to see if an object is of a specific com.quinncurtis.chart2dnet class type. |
static double |
log10Abs(double r)
Converts the absolute value of a number to its log base 10 value. |
static double |
log10Ex(double r)
Converts a number to its log base 10 value. |
static DoubleArray |
makeCompressArray(int ctype,
int wSkip,
int lFirst,
int lLast,
DoubleArray source,
BoolArray validflags)
This methods creates and returns a new array that is the data reduced version of the source array. |
static DoubleArray2D |
makeGroupCompressArray(int ctype,
int wSkip,
int lFirst,
int lLast,
DoubleArray2D source,
BoolArray validflags)
This methods creates and returns a new group data array that is the data reduced version of the source array. |
static DoubleArray |
makeTimeCompressArray(int compresstimefield,
int compresstype,
int lFirst,
int lLast,
DoubleArray sourcetime,
DoubleArray sourcey,
BoolArray validflags)
This methods creates and returns a new array of time based values that is the data reduced version of the source array of time based values. |
static boolean |
nearTest(double a1,
double a2,
double threshold)
This method returns true if the difference between two numbers is less than the specified threshold value. |
static java.lang.String |
numToString(double num,
int format,
int decs,
java.lang.String numStrPostfix)
This method converts a numeric value to a string using the specified string format. |
static void |
swapCoords(ChartPoint2D source)
|
static void |
swapCoords(ChartPoint2D dest,
ChartPoint2D source)
Swaps the values of two points |
static double |
toDegrees(double radians)
This method converts from radians to degrees. |
static double |
toRadians(double degrees)
This method converts from degrees to radians. |
Methods inherited from class com.quinncurtis.chart2djava.ChartObj |
---|
copy, errorCheck, getChartObjIDCntr, getChartObjType, getThisChartObjID, TypeSafeVectorCopy |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ChartSupport()
Method Detail |
---|
public static int adjustDecs(double r, int decs)
r
- The input value.decs
- The original calculated value for the number of digits to the right of the decimal point.
public static double antilog10Ex(double r)
r
- A floating point value -30 to +30, representing the log base 10 of MIN_LOG_VALUE and
log base 10 of MAX_LOG_VALUE.
public static boolean bGoodValue(ChartPoint2D p)
p
- The x- and y-coordinates
public static boolean bGoodValue(double x)
public static boolean bGoodValue(double x, double y)
x
- The x-coordinate.y
- The y-coordinate.
public static boolean bGoodValue(double x1, double y1, double z1)
x1
- The x-coordinate.y1
- The y-coordinate.z1
- The z-coordiante.
public static boolean bGoodValue(double x1, double y1, double x2, double y2)
x1
- The x-coordinate for the first point of the line segment.y1
- The y-coordinate for the first point of the line segment.x2
- The x-coordinate for the second point of the line segment.y2
- The y-coordinate for the second point of the line segment.
public static boolean calcNearestPoint(PhysicalCoordinates transform, GroupDataset dataset, boolean coordswap, ChartPoint2D testpoint, int nmode, NearestPointData nearestpoint)
transform
- The coordinate system of the test point.dataset
- The dataset that is checked for the nearest point.coordswap
- If the x-values in the dataset correspond to the x-coordinates of the
chart coordinate system, specify false, otherwise specify true.testpoint
- The test point for the nearness calculation.nmode
- Specifies the algorithm used in the nearness calculation.nearestpoint
- Returns the parameters of the nearest point.
public static boolean calcNearestPoint(PhysicalCoordinates transform, SimpleDataset dataset, boolean coordswap, ChartPoint2D testpoint, int nmode, NearestPointData nearestpoint)
transform
- The coordinate system of the test point.dataset
- The dataset that is checked for the nearest point.coordswap
- If the x-values in the dataset correspond to the x-coordinates of the
chart coordinate system, specify false, otherwise specify true.testpoint
- The test point for the nearness calculation.nmode
- Specifies the algorithm used in the nearness calculation.nearestpoint
- Returns the parameters of the nearest point.
public static int clampInt(int i, int lowvalue1, int highvalue1)
i
- The input variable.lowvalue1
- The input variable is checked against this low value, and set equal to this
value if the value is less than the low threshold.highvalue1
- The input variable is checked against this high value, and set equal to this
value if the value is greater than the high threshold.
public static double clampReal(double r, double lowvalue1, double highvalue1)
r
- The input variable.lowvalue1
- The input variable is checked against this low value, and set equal to this
value if the value is less than the low threshold.highvalue1
- The input variable is checked against this high value, and set equal to this
value if the value is greater than the high threshold.
public static ChartPoint3D clampToViewCoordinates(ChartPoint3D p)
public static double clampToViewCoordinates(double r)
r
- The input value.
public java.lang.Object clone()
clone
in class java.lang.Object
public static int findRelatedAxisLabels(int index, java.util.Vector<GraphObj> source)
index
- The index of the Axis in the source vector.source
- The vector of all GraphObj objects managed by a ChartView object.
public static int findRelatedAxisTitleAxis(int index, java.util.Vector<GraphObj> source)
index
- The index of the AxisTitle in the source vector.source
- The vector of all GraphObj objects managed by a ChartView object.
public static int findRelatedGridAxes(int index, java.util.Vector<GraphObj> source, java.awt.Dimension axesresults)
index
- The index of the Grid in the source vector.source
- The vector of all GraphObj objects managed by a ChartView object.axesresults
- Returns the index of the x-axis as axesresults.width, and
the index of the y-axis Axis objectas axesresults.height.
public static int findRelatedPolarAxesLabels(int index, java.util.Vector<GraphObj> source)
index
- The index of the PolarAxes in the source vector.source
- The vector of all GraphObj objects managed by a ChartView object.
public static void fixCommonRangeError(ChartRectangle2D rect, double typicalmin, double typicalmax)
rect
- Passes in and returns the returns (adjusted if necessary) the x-dimension and y-dimesion
minimum and maximum values.typicalmin
- The minimum allowable value to use in the check.typicalmax
- The The maximum allowable value to use in the check.public static double[] floatToDoubleArray(float[] floatarray)
floatarray
- An array of floats.
public static java.awt.Color fromArgb(int alpha, int r, int g, int b)
public static int getCoordinateSystemType(PhysicalCoordinates transform)
transform
- The source coordinate system.
public static double getDatasetsMax(ChartDataset[] datasets, int numdatasets, int naxis)
datasets
- An array, size [numdatasets], of SimpleDataset objects.numdatasets
- The number of datasets in the datasets array.naxis
- Specifies which coordinate to analyze, the x-coordinate (use the X_AXIS constant),
or the y-coordinate (use the Y_AXIS constant).
public static double getDatasetsMin(ChartDataset[] datasets, int numdatasets, int naxis)
datasets
- An array, size [numdatasets], of SimpleDataset objects.numdatasets
- The number of datasets in the datasets array.naxis
- Specifies which coordinate to analyze, the x-coordinate (use the X_AXIS constant),
or the y-coordinate (use the Y_AXIS constant).
public static double getDatasetsSumMax(GroupDataset[] datasets, int numdatasets, int naxis)
datasets
- An array, size [numdatasets], of GroupDataset objects.numdatasets
- The number of datasets in the datasets array.naxis
- Specifies which coordinate to analyze, the x-coordinate (use the X_AXIS constant),
or the y-coordinate (use the Y_AXIS constant).
public static double getDatasetsSumMin(GroupDataset[] datasets, int numdatasets, int naxis)
datasets
- An array, size [numdatasets], of GroupDataset objects.numdatasets
- The number of datasets in the datasets array.naxis
- Specifies which coordinate to analyze, the x-coordinate (use the X_AXIS constant),
or the y-coordinate (use the Y_AXIS constant).
public static int getFirstValidIndex(boolean[] valid, int n)
valid
- An array of boolean values.n
- The number of elements in the array.
public static int getFirstValidIndex(ChartPoint2D[] p, int n)
p
- An array of points.n
- The number of elements in the array.
public static int getFirstValidIndex(double[] x, double[] y, int n)
x
- An array of x-coordinate values.y
- An array of y-coordinate values.n
- The number of elements in the array.
public static int getFirstValidIndex(double[] r, int n)
r
- An array of doubles.n
- The number of elements in the array.
public static double getFirstValidValue(double[] r, int n)
r
- An array of doubles.n
- The number of elements in the array.
public static double getMaximum(double[] rbuffer)
rbuffer
- An array that contains the data values to check.
public static double getMaximum(DoubleArray r)
r
- An array that contains the data values to check.
public static double getMaximum(DoubleArray2D rc, BoolArray valid, int ngroup)
rc
- A 2D array that contains the data values to check.valid
- An array that specifies a true or false value for every value in the r array,
specifying if the value is valid.ngroup
- Number of groups to analyze in array.
public static double getMaximum(DoubleArray r, BoolArray valid)
r
- An array that contains the data values to check.valid
- An array that specifies a true or false value for every value in the r array,
specifying if the value is valid.
public static double getMinimum(double[] rbuffer)
rbuffer
- An array that contains the data values to check.
public static double getMinimum(DoubleArray r)
r
- An array that contains the data values to check.
public static double getMinimum(DoubleArray2D rc, BoolArray valid, int ngroup)
rc
- A 2D array that contains the data values to check.valid
- An array that specifies a true or false value for every value in the r array,
specifying if the value is valid.ngroup
- Number of groups to analyze in array.
public static double getMinimum(DoubleArray r, BoolArray valid)
r
- An array that contains the data values to check.valid
- An array that specifies a true or false value for every value in the r array,
specifying if the value is valid.
public static int getNumColumns(double[][] y)
public static int getNumColumns(java.util.GregorianCalendar[][] y)
public static double getRandomDouble()
public static boolean isKindOf(java.lang.Object obj, java.lang.String typestring)
obj
- The com.quinncurtis.chart2dnet object that is tested.typestring
- A string representing a com.quinncurtis.chart2dnet class. For example,
the string "Obj" will result in true being returned for all com.quinncurtis.chart2dnet objects
since all objects have Obj as a super class. The string "MultiLinePlot" will only return true if
the test object of the MultiLinePlot type.
public static boolean isKindOf(java.lang.Object obj, java.lang.String typestring, boolean appendqc)
obj
- The com.quinncurtis.chart2dnet object that is tested.typestring
- A string representing a com.quinncurtis.chart2dnet class. For example,
the string "Obj" will result in true being returned for all com.quinncurtis.chart2dnet objects
since all objects have Obj as a super class. The string "MultiLinePlot" will only return true
if the test object of the MultiLinePlot type.appendqc
- True appends "com.quinncurtis.chart2dnet." to the front of the type string.
public static boolean isStackedPlotType(ChartPlot plotobj)
plotobj
- The plot object to test.
public static boolean isType(java.lang.Object obj, java.lang.String typestring)
obj
- The com.quinncurtis.chart2dnet object that is tested.typestring
- A string representing a com.quinncurtis.chart2dnet class. For example,
the string "Obj" will result in true being returned for all com.quinncurtis.chart2dnet objects since
all objects have Obj as a super class. The string "MultiLinePlot" will only return true if the test
object of the MultiLinePlot type.
public static double log10Abs(double r)
r
- A floating point value in the positive range MIN_LOG_VALUE to MAX_LOG_VALUE.
public static double log10Ex(double r)
r
- A floating point value in the positive range MIN_LOG_VALUE to MAX_LOG_VALUE.
public static DoubleArray makeCompressArray(int ctype, int wSkip, int lFirst, int lLast, DoubleArray source, BoolArray validflags)
ctype
- The compression type for the source values. Use one of the data compression type
constants: DATACOMPRESS_NONE (returns an array containing the points in the specified range, no compression),
DATACOMPRESS_SKIP (sample the array every interval points), DATACOMPRESS_AVERAGE (use the average value in each
interval of wSkip points), DATACOMPRESS_MIN (use the minimum value in each interval of wSkip points),
DATACOMPRESS_MAX (use the maximum value in each interval of wSkip points), and DATACOMPRESS_MINMAX
(use the minimum and maximum value in each interval of wSkip points).wSkip
- The number of data points in each segment that is reduced to a single datapoint (the
interval is wSkip 2 for the DATACOMPRESS_MINMAX compression type because it is reduced to two data points,
min and max) in the compressed dataset.lFirst
- The starting point, inclusive, in the source array for the data compression.lLast
- The ending index, inclusive, in the source array for the data compression.source
- The source array of data to be reduced.validflags
- An array, the same size as the source array, that specify whether
individual data points in the source array are valid.
public static DoubleArray2D makeGroupCompressArray(int ctype, int wSkip, int lFirst, int lLast, DoubleArray2D source, BoolArray validflags)
ctype
- The compression type for the source values. Use one of the data compression
type constants: DATACOMPRESS_NONE (returns an array containing the points in the specified range,
no compression), DATACOMPRESS_SKIP (sample the array every interval points), DATACOMPRESS_AVERAGE
(use the average value in each interval of wSkip points), DATACOMPRESS_MIN (use the minimum value
in each interval of wSkip points), DATACOMPRESS_MAX (use the maximum value in each interval
of wSkip points), and DATACOMPRESS_MINMAX (use the minimum and maximum value in each interval of
wSkip points).wSkip
- The number of data points in each segment that is reduced to a single
datapoint (the interval is wSkip 2 for the DATACOMPRESS_MINMAX compression type because
it is reduced to two data points, min and max) in the compressed dataset.lFirst
- The starting point, inclusive, in the source array for the data compression.lLast
- The ending index, inclusive, in the source array for the data compression.source
- The source array (2D array of group data dimensioned as [ngrups,numpoints])
of data to be reduced.validflags
- An array, the size [numpoints], that specify whether a given index
(source[,index]) in the source array is valid.
public static DoubleArray makeTimeCompressArray(int compresstimefield, int compresstype, int lFirst, int lLast, DoubleArray sourcetime, DoubleArray sourcey, BoolArray validflags)
compresstimefield
- All values with the same time field value are compressed to a
single value. Use one of the time field constants in the - ChartConstants.YEAR, ChartConstants.MONTH,
ChartConstants.WEEK_OF_YEAR, ChartConstants.WEEK_OF_MONTH, ChartConstants.DAY_OF_YEAR, ChartConstants.HOUR_OF_DAY,
ChartConstants.MINUTE.compresstype
- The compression type for the source values. Use one of the
data compression type constants: DATACOMPRESS_NONE (returns an array containing the points
in the specified range, no compression), DATACOMPRESS_SKIP (sample the array every interval points),
DATACOMPRESS_AVERAGE (use the average value in each interval of wSkip points), DATACOMPRESS_MIN
(use the minimum value in each interval of wSkip points), DATACOMPRESS_MAX (use the maximum value
in each interval of wSkip points), and DATACOMPRESS_MINMAX (use the minimum and maximum value in each
interval of wSkip points).lFirst
- The starting point, inclusive, in the source array for the data compression.lLast
- The ending index, inclusive, in the source array for the data compression.sourcetime
- The source time array for the data to be reduced. It must be time based values.sourcey
- The source array that is actually reduced. It can be either numeric y-values, or
time based values.validflags
- An array, the same size as the source array, that specify whether individual
data points in the source array are valid.
public static boolean nearTest(double a1, double a2, double threshold)
a1
- The first of two numbers.a2
- The second of two numbers.threshold
- The threshold value.
public static java.lang.String numToString(double num, int format, int decs, java.lang.String numStrPostfix)
num
- The input number.format
- The numeric format used in the conversion. Use one of the
axis label format constants: DECIMALFORMAT, SCIENTIFICFORMAT, BUSINESSFORMAT, ENGINEERINGFORMAT,
PERCENTFORMAT, BUSINESSCURRENCYFORMAT, CURRENCYFORMAT.decs
- The number of digits to display to the right of the decimal point.numStrPostfix
- A string specifying the post fix charactors for the BUSINESSFORMAT
and BUSINESSCURRENCYFORMAT. The default string is "KMBT".
public static void swapCoords(ChartPoint2D source)
public static void swapCoords(ChartPoint2D dest, ChartPoint2D source)
dest
- The first point.source
- The second point.public static double toDegrees(double radians)
radians
- The radians to convert.
public static double toRadians(double degrees)
degrees
- The degrees to convert.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |