|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.rosuda.ibase.Notifier org.rosuda.ibase.toolkit.Axis
public class Axis
Axis - implements transformation of cases, values or categories to orthogonal graphical coordinates and vice versa. Supported axis types are: numerical, equidistant (i.e. nominal/ordinal by index), categorical-equidistant, categorical-proportional by population.
Field Summary | |
---|---|
int |
datacount
count for discrete axes |
boolean |
drawAxis
|
int |
gBegin
graphical start and length |
int |
gLen
graphical start and length |
static int |
O_Horiz
Axis orientation: horizontal (X) |
static int |
O_Vert
Axis orientation: vertical (Y) |
static int |
O_X
Axis orientation: horizontal (X) |
static int |
O_Y
Axis orientation: vertical (Y) |
static int |
T_EqCat
Axis type: equidistant categorical |
static int |
T_EqSize
Axis type: equidistant (i.e. discrete/nominal/ordinal by index) |
static int |
T_Num
Axis type: numerical |
static int |
T_PropCat
Axis type: proportional categorical |
int |
trl
orthogonal translation in percent |
double |
vBegin
value begin and length |
double |
vLen
value begin and length |
Constructor Summary | |
---|---|
Axis(SVar srcv)
create a new Axis with variable srcv, default orientation (horizontal) and default type guessing and default range |
|
Axis(SVar srcv,
int orientation,
int axisType)
create new Axis with variable srvc, specified orientation and type and default range |
Method Summary | |
---|---|
int |
clip(int gv)
clips supplied graphical value to axis' region |
int |
getCasePos(int i)
get graphical position of case with index i (for categorial vars returns the same as getCatCenter called for the category of the case) |
int |
getCatAtSeqIndex(int c)
Inverse of getCatSeqIndex(int) . |
int |
getCatByPos(int pos)
get category corresponding to a position on screen (type1 and 2 only) |
int |
getCatCenter(int i)
get central geometry for category of index i (just a faster way to get (Low+Up)/2 ) |
int |
getCatLow(int i)
get lower geometry for category of index i (type 1,2 only) |
int |
getCatSeqIndex(int c)
for cat types return the position of a category in the sequence of categories. w/o reordering it's always c. |
int |
getCatUp(int i)
get upper geometry for category of index i (type 1,2 only) |
java.lang.String |
getDisplayableValue(double val)
returns string representation of the supplied value, taking into account the range (vLen) to determine how many digits to display behind the fp |
int |
getOrientation()
return axis orientation |
int |
getRegularCatPos(int i,
int leftGap,
int rightGap)
get regular geometry for category of index i (e.g. for parallel coordinates plots) |
double |
getSensibleTickDistance(int medDist,
int minDist)
returns a tick distance that is somewhat "sensible" to be used for ticks given mean required distance. |
double |
getSensibleTickStart(double tickDist)
returns first visible tick given a tick distance. it is mostly used in conjunction with getSensibleTickDistance(int, int) |
int |
getType()
|
double |
getValueForPos(int pos)
get value corresponding to a geometrical position val
(for type=0 and 3 only), hence this is the inverse of getValuePos(double) |
int |
getValuePos(double val)
get graphical position of value val (for type=0 and 3 only) |
double[] |
getValueRange()
returns value range as an array of two doubles specifying top and bottom end. to ensure reproducibility the orientation is preserved, therefore it is not guaranteed that the second value is greater that the first one. |
SVar |
getVariable()
returns associated variable. |
boolean |
moveCat(int c,
int npos)
move category to another position in the sequence, all remaining categories between the current and new position will be moved correspondingly |
void |
setDefaultRange()
set default range for the axis (ie for numerical variable min, max are used, for all other types the maixmal count is used. |
void |
setDefaultRange(boolean resetCseq)
set default range for the axis (i.e. for numerical variable min, max are used, for all other types the maixmal count is used.) |
void |
setGeometry(int orientation,
int begin,
int len)
set geomery of the axis and notifies dependents upon change |
void |
setOrthTrans(int trl)
moves the axis along the orthogonal direction |
void |
setType(int nt)
change axis type (implicitely calls setDefaultRange() but preserves
cat sequence if switching between "compatible" types, i.e. 1 and 2) |
boolean |
setValueRange(double[] range)
same as setValueRange(double, double) , but takes an array of two doubles as returned by getValueRange() |
boolean |
setValueRange(double begin,
double len)
for numerical variables - set range of the variable's values. |
boolean |
setValueRange(int dc)
for discrete axis types - set the data count |
void |
setVariable(SVar var)
|
boolean |
swapCats(int c1,
int c2)
swap positions of two categories |
java.lang.String |
toString()
somewhat simple toString implementation, basically for debugging purposes |
Methods inherited from class org.rosuda.ibase.Notifier |
---|
addDepend, beginBatch, delDepend, endBatch, NotifyAll, NotifyAll, NotifyAll, NotifyAll, startCascadedNotifyAll |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int O_Horiz
public static final int O_Vert
public static final int O_X
public static final int O_Y
public static final int T_Num
public static final int T_EqCat
public static final int T_PropCat
public static final int T_EqSize
public int gBegin
public int gLen
public double vBegin
public double vLen
public int datacount
public int trl
public boolean drawAxis
Constructor Detail |
---|
public Axis(SVar srcv)
srcv
- source variable (cannot be null
! for pure numerical axes use constructor!)public Axis(SVar srcv, int orientation, int axisType)
srcv
- source variable (can be null
if axis type is T_Num or T_EqSize resulting in virtual axis)orientation
- orientationaxisType
- axis typeMethod Detail |
---|
public int getOrientation()
public void setType(int nt)
setDefaultRange()
but preserves
cat sequence if switching between "compatible" types, i.e. 1 and 2)
public int getType()
public void setGeometry(int orientation, int begin, int len)
orientation
- orientation of the axis (horiz/vert)begin
- begin/anchor of the axis - i.e. the pixel to correspond to vBegin
length
- length of the axis (note: may be negative if necessary)public boolean setValueRange(double begin, double len)
begin
- begin/anchor of axis in data domainlen
- length of the axis (can be negative if necessary)
true
if this method had any effect on the Axis or false
if the values match status quopublic boolean setValueRange(double[] range)
setValueRange(double, double)
, but takes an array of two doubles as returned by getValueRange()
public boolean setValueRange(int dc)
dc
- data count, if <1 then set to 1
true
if this method had any effect on the Axis or false
if the values match status quopublic void setDefaultRange()
public void setDefaultRange(boolean resetCseq)
reseCseq
- If true
for categorial types this also resets categories sequence to default (ordered by cat ID)public SVar getVariable()
null
for virtual axes
public void setVariable(SVar var)
public int getCasePos(int i)
i
- index of the case
public int getValuePos(double val)
val
(for type=0 and 3 only)
val
- value
public double getValueForPos(int pos)
val
(for type=0 and 3 only), hence this is the inverse of getValuePos(double)
pos
- position on the screen
public int clip(int gv)
gv
- graphical value
public int getCatLow(int i)
i
- category index
public int getCatUp(int i)
i
- category index
public int getCatCenter(int i)
i
- category index
public int getRegularCatPos(int i, int leftGap, int rightGap)
i
- category indexleftGap
- left gaprightGap
- right gap
public int getCatByPos(int pos)
pos
- position
public boolean swapCats(int c1, int c2)
c1
- category 1c2
- category 2
true
on success, false
on failure
(i.e. some index was out of bounds)public boolean moveCat(int c, int npos)
c
- category to movenpos
- new position in the sequence - it is clipped if necessary,
i.e. specifying values <0 will move it to the begining and >=cats will
move it to the end of the sequence
true
on success, false
on failurepublic int getCatSeqIndex(int c)
moveCat(int, int)
as npos parameter when destination
is also a category
c
- category index
public int getCatAtSeqIndex(int c)
getCatSeqIndex(int)
.
public double getSensibleTickDistance(int medDist, int minDist)
medDist
- mean required distancemindist
- minimal required distance (if set to 0 only powers of 10 will be used)
public double getSensibleTickStart(double tickDist)
getSensibleTickDistance(int, int)
tickDist
- tick distance
public java.lang.String getDisplayableValue(double val)
val
- value to display
public double[] getValueRange()
public void setOrthTrans(int trl)
public java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |