public class Axis extends Object
Modifier and Type | Field and Description |
---|---|
Color |
axiscolor
Color of the Axis.
|
static int |
BOTTOM
Constant flagging Axis position on the graph.
|
Dimension |
data_window
Before the Axis can be positioned correctly and drawn the data window
needs to be calculated and passed to the Axis.
|
boolean |
drawgrid
If true draw a grid positioned on major ticks over the graph
|
boolean |
drawzero
If true draw a line positioned on the Zero label tick mark.
|
boolean |
force_end_labels
Rescale the axis so that labels fall at the end of the Axis.
|
Graph2D |
g2d
The graph canvas this axis is attached to (if it is attached to any)
|
Color |
gridcolor
Color of the grid
|
static int |
LEFT
Constant flagging Axis position on the graph.
|
int |
major_tic_size
Size in pixels of the major tick marks
|
double |
maximum
Maximum data value of the axis.
|
double |
minimum
Minimum data value of the axis.
|
int |
minor_tic_count
Number of minor tick marks between major tick marks
|
int |
minor_tic_size
Size in pixels of the minor tick marks
|
boolean |
redraw
Default value true.
|
static int |
RIGHT
Constant flagging Axis position on the graph.
|
static int |
TOP
Constant flagging Axis position on the graph.
|
Color |
zerocolor
Color of the line at the Zero label
|
Constructor and Description |
---|
Axis()
Instantiate the class.
|
Axis(int p)
Instantiate the class.
|
Modifier and Type | Method and Description |
---|---|
void |
attachDataSet(DataSet d)
Attach a DataSet for the Axis to manage.
|
void |
detachAll()
Detach All attached dataSets.
|
void |
detachDataSet(DataSet d)
Detach an attached DataSet
|
void |
drawAxis(org.freehep.graphics2d.VectorGraphics g)
Draw the axis using the passed Graphics context.
|
int |
getAxisPos()
Return the position of the Axis.
|
int |
getAxisWidth(org.freehep.graphics2d.VectorGraphics g)
Return the width of the axis.
|
double |
getDataMax()
Return the maximum value of All datasets attached to the axis.
|
double |
getDataMin()
Return the minimum value of All datasets attached to the axis.
|
double |
getDouble(int i)
Return the data value equivalent of the passed pixel position.
|
int |
getInteger(double v)
Return the pixel equivalent of the passed data value.
|
boolean |
isVertical()
If the Axis is Vertical return true.
|
boolean |
positionAxis(int xmin,
int xmax,
int ymin,
int ymax)
Position the axis at the passed coordinates.
|
void |
resetRange()
Reset the range of the axis (the minimum and maximum values) to the
default data values.
|
void |
setExponentColor(Color c)
Set the color of the exponent
|
void |
setExponentFont(Font f)
Set the font of the exponent
|
void |
setLabelColor(Color c)
Set the color of the labels
|
void |
setLabelFont(Font f)
Set the font of the labels.
|
void |
setManualRange(boolean b)
Is the range of the axis to be set automatically (based on the data)
or manually by setting the values Axis.minimum and Axis.maximum?
|
void |
setPosition(int p)
Set the axis position.
|
void |
setTitleColor(Color c)
Set the color of the title
|
void |
setTitleFont(Font f)
Set the font of the title
|
void |
setTitleRotation(int a)
Set the title rotation angle.
|
void |
setTitleText(String s)
Set the title of the axis
|
public static final int LEFT
public static final int RIGHT
public static final int TOP
public static final int BOTTOM
public boolean drawgrid
public boolean drawzero
public Color gridcolor
public Color zerocolor
public boolean redraw
Axis#drawAxis()
public boolean force_end_labels
public int major_tic_size
public int minor_tic_size
public int minor_tic_count
public Color axiscolor
public double minimum
public double maximum
public Dimension data_window
public Axis()
public Axis(int p)
p
- Set the axis position. Must be one of Axis.BOTTOM,
Axis.TOP, Axis.LEFT, Axis.RIGHT, Axis.HORIZONTAL or Axis.VERTICAL.
If one of the latter two are used then Axis.BOTTOM or
Axis.LEFT is assumed.public void setPosition(int p)
p
- Must be one of Axis.BOTTOM,
Axis.TOP, Axis.LEFT, Axis.RIGHT, Axis.HORIZONTAL or Axis.VERTICAL.
If one of the latter two are used then Axis.BOTTOM or
Axis.LEFT is assumed.public void attachDataSet(DataSet d)
d
- dataSet to attachDataSet
public void detachDataSet(DataSet d)
d
- dataSet to detachDataSet
public void detachAll()
public double getDataMin()
public double getDataMax()
public int getInteger(double v)
v
- data value to convertgraph.Axis#getDouble( )
public double getDouble(int i)
i
- pixel valuegraph.Axis#getInteger( )
public void resetRange()
public int getAxisPos()
public boolean isVertical()
public int getAxisWidth(org.freehep.graphics2d.VectorGraphics g)
g
- graphics context.public boolean positionAxis(int xmin, int xmax, int ymin, int ymax)
xmin
- The minimum X pixelxmax
- The maximum X pixel. These should be equal if the axis
is verticalymin
- The minimum Y pixelymax
- The maximum Y pixel. These should be equal if the axis
is horizontalpublic void drawAxis(org.freehep.graphics2d.VectorGraphics g)
g
- Graphics context for drawingpublic void setTitleText(String s)
s
- string containing text.public void setTitleColor(Color c)
c
- Color of the title.public void setTitleFont(Font f)
c
- Title font.public void setTitleRotation(int a)
a
- Title rotation angle in degrees.public void setLabelColor(Color c)
c
- Color of the labels.public void setLabelFont(Font f)
f
- font.public void setExponentColor(Color c)
c
- Color.public void setExponentFont(Font f)
f
- font.public void setManualRange(boolean b)
b
- boolean value.Jas4pp 1.5 © Java Analysis Studio for Particle Physics