public class Axis extends Object
Constructor and Description |
---|
Axis() |
Modifier and Type | Method and Description |
---|---|
static int |
calculateTicNumber(double ticMinVal,
double ticMaxVal,
double xStep,
boolean isLog)
Precompute number of ticks
|
static double |
calculateTicSep(double min,
double max,
int maxNumberOfTicks)
Calculation of the separation length between tics.
|
static Vector<String> |
computeTicks(double ticMinVal,
double ticMaxVal,
int maxTicks,
boolean isLog)
this is the central method of this class.
|
static void |
drawAxis(int axis,
int maxTics,
int ticLength,
float lowVal,
float highVal,
int screenStart,
int screenEnd,
int screenOffset,
boolean logScale,
int screenHeight,
Graphics g)
high-level method for drawing a chart axis line plus labeled tic marks.
|
static double |
exp10(double val) |
static float |
fexp10(double val) |
static float |
flog10(double val) |
static double |
log10(double val) |
static void |
main(String[] args)
simple example program for Axis class.
|
static int |
plotValue(float val,
float lowVal,
float highVal,
int screenStart,
int screenEnd,
boolean logScale,
int screenHeight)
lower level method to determine a screen location where a given value
should be plotted given range, type, and screen information.
|
static Dimension |
stringSize(String str,
Graphics g)
handy little utility for determining the length in pixels the given
string will use if drawn into the given Graphics object.
|
public static final int X_AXIS
public static final int Y_AXIS
public static double log10(double val)
public static double exp10(double val)
public static float flog10(double val)
public static float fexp10(double val)
public static double calculateTicSep(double min, double max, int maxNumberOfTicks)
public static int calculateTicNumber(double ticMinVal, double ticMaxVal, double xStep, boolean isLog)
public static Vector<String> computeTicks(double ticMinVal, double ticMaxVal, int maxTicks, boolean isLog)
float ticval = Float.parseFloat(ticstring);
ticMinVal
- no tics will be created for less than this value.ticMaxVal
- no tics will be created for greater than this value.maxTics
- returned vector will contain no more labels than this number.isLog
- set to true in case of log10 numberspublic static void drawAxis(int axis, int maxTics, int ticLength, float lowVal, float highVal, int screenStart, int screenEnd, int screenOffset, boolean logScale, int screenHeight, Graphics g)
axis
- is one of Axis.X_AXIS or Axis.Y_AXIS.maxTics
- is the maximum number of labeled tics to draw. note: the
actual number drawn may be less.lowVal
- is the smallest value tic mark that may be drawn. note: the
lowest valued tic label may be greater than this limit.highVal
- is the largest value tic mark that may be drawn. note: the
highest valued tic label may be less than this limit.screenStart
- is the coordinate in the low valued direction.screenEnd
- is the coordinate in the high valued direction.offset
- is the coordinate in the direction perpendicular to the
specified direction.logScale
- is true if a log scale axis is to be drawn, false for a linear
scale.screenHeight
- is needed to flip Y coordinates.g
- is the AWT Graphics object to draw into. note: all drawing
will be done in the current color of the given Graphics
object.public static int plotValue(float val, float lowVal, float highVal, int screenStart, int screenEnd, boolean logScale, int screenHeight)
val
- is a data value to be plotted.drawAxis(int,int,int,float,float,int,int,int,boolean,int,Graphics)
public static Dimension stringSize(String str, Graphics g)
public static void main(String[] args)
Jas4pp 1.5 © Java Analysis Studio for Particle Physics