|
JIDE 3.5.15 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.jidesoft.chart.axis.Axis
public class Axis
Represents an axis in the chart display.
Field Summary | |
---|---|
static double |
MIN_RESOLUTION
|
static String |
PROPERTY_AXIS_COLOR
|
static String |
PROPERTY_LABEL
|
static String |
PROPERTY_MINOR_TICK_COLOR
|
static String |
PROPERTY_MINOR_TICK_LENGTH
|
static String |
PROPERTY_RANGE
|
static String |
PROPERTY_STROKE
|
static String |
PROPERTY_TICK_CALCULATOR
|
static String |
PROPERTY_TICK_COLOR
|
static String |
PROPERTY_TICK_FONT
|
static String |
PROPERTY_TICK_LABEL_COLOR
|
static String |
PROPERTY_TICK_LENGTH
|
static String |
PROPERTY_TICKS
|
static String |
PROPERTY_UPDATE_OTHER_AXES
|
Constructor Summary | |
---|---|
Axis()
No-args constructor |
|
Axis(AutoPositionedLabel label)
Create an axis using the given label |
|
Axis(double min,
double max)
Create an axis using the supplied minimum and maximum values to set the range of the axis. |
|
Axis(Range<?> newRange)
Create an axis using the given range to define the minimum and maximum values |
|
Axis(Range<?> newRange,
String labelText)
Create an Axis, using the text as the label |
|
Axis(String labelText)
Create an axis using the supplied text to create a label |
Method Summary | |
---|---|
void |
addPropertyChangeListener(PropertyChangeListener listener)
A property change event will be fired when this axis changes its range. |
boolean |
equals(Object o)
|
Color |
getAxisColor()
Returns the color to use when painting the axis |
AxisRenderer |
getAxisRenderer()
|
InvertibleTransform<Double> |
getAxisTransform()
|
Range<Double> |
getDomain()
|
double |
getFloatingPosition()
Returns the floating position. |
AutoPositionedLabel |
getLabel()
|
Integer |
getLabelWidth()
|
Color |
getMinorTickColor()
Returns the value for the minor tick Color |
int |
getMinorTickLength()
Returns the length of minor ticks, in pixels |
Range<?> |
getOutputRange()
Returns the range of values for this axis, after the transformation (if any) has been applied |
AxisPlacement |
getPlacement()
Returns the placement of the axis |
AxisQuantity |
getQuantity()
Returns the quantity for the axis, i.e. |
Range<?> |
getRange()
|
Stroke |
getStroke()
Returns the stroke used when drawing the axis |
TickCalculator |
getTickCalculator()
Returns the tick calculator |
Color |
getTickColor()
Returns the tick color for the axis |
Font |
getTickFont()
Returns the font currently used for tick labels |
Color |
getTickLabelColor()
Returns the color used for tick labels on this axis |
int |
getTickLabelOffset()
|
double |
getTickLabelRotation()
Returns the current tick label rotation, given in radians. |
int |
getTickLength()
Returns the length of major ticks, in pixels |
Tick[] |
getTicks()
Returns an array of ticks for this axis |
int |
hashCode()
|
boolean |
isFlipped()
|
boolean |
isLabelVisible()
Returns whether the label should be visible |
boolean |
isTicksVisible()
Returns whether ticks are currently visible |
boolean |
isVisible()
Returns whether the axis is currently visible |
int |
labelWidth(Graphics g,
Font tickFont,
Orientation orientation)
Determines how much space to allow for the tick labels at the side of an axis |
int |
labelWidth(Graphics g,
Font tickFont,
Orientation orientation,
Tick[] ticks)
|
double |
maximum()
Returns the maximum of the input range |
double |
midPoint()
Calculates the mid point of the range |
double |
minimum()
Returns the minimum of the input range |
void |
propertyChange(PropertyChangeEvent evt)
|
void |
removePropertyChangeListener(PropertyChangeListener listener)
Remove a listener that receives notification of property changes. |
void |
render(Graphics g,
int x,
int y,
int length,
Orientation orientation)
Render the axis onto the supplied graphics context |
void |
setAxisColor(Color axisColor)
Specify the color to use when painting the axis |
void |
setAxisRenderer(AxisRenderer axisRenderer)
Sets the renderer for the axis |
void |
setAxisTransform(InvertibleTransform<Double> axisTransform)
|
void |
setDomain(Range<Double> domain)
|
void |
setFlipped(boolean flipped)
|
void |
setFloatingPosition(double floatingPos)
Sets the floating position. |
void |
setLabel(AutoPositionedLabel newValue)
|
void |
setLabel(String text)
|
void |
setLabelVisible(boolean labelVisible)
Specify whether the axis label is visible. |
void |
setLabelWidth(Integer labelWidth)
The label width is the variable part of the width of the axis. |
void |
setMinorTickColor(Color minorTickColor)
Specify the color used for painting minor ticks. |
void |
setMinorTickLength(int minorTickLength)
Specify the length of minor ticks, in pixels |
void |
setPlacement(AxisPlacement placement)
Specifies whether the axis is to be placed at the leading or trailing edge of the interval, or placed in the centre |
void |
setRange(double min,
double max)
Sets the range for the axis to be a numeric range with the supplied minimum and maximum values |
void |
setRange(Range<?> range)
Sets the range for the axis to be the supplied range |
void |
setRange(Range<?> range,
boolean updateOtherAxes)
Set the range of the axis. |
void |
setRange(Range<?> range,
boolean updateOtherAxes,
boolean fireEvent)
Sets the range, with the option of not firing a property change event. |
void |
setStroke(Stroke stroke)
Specifies the stroke to use for the axis |
void |
setTickCalculator(TickCalculator tickCalculator)
Specify the tick calculator to use for this axis. |
void |
setTickColor(Color tickColor)
The chart class contains a tickColor attribute, but you can override that value by setting the tick color on an instance of Axis. |
void |
setTickFont(Font tickFont)
Specify the font to use for tick labels |
void |
setTickLabelColor(Color tickLabelColor)
Sets the tick label color and overrides the default value set in the Chart class |
void |
setTickLabelOffset(int offset)
Specify a gap between the tick and the tick label |
void |
setTickLabelRotation(double tickLabelRotation)
Specify a rotation for the tick labels, given in radians. |
void |
setTickLength(int tickLength)
Specify the length of major ticks, in pixels |
void |
setTicksVisible(boolean ticksVisible)
Specify whether ticks should be visible |
void |
setVisible(boolean visible)
Specify whether the axis should be visible. |
String |
toString()
|
protected void |
updateTicks()
Updates the cached array of ticks |
static Range<?> |
zoom(Axis axis,
double magnificationFactor)
Adjusts this axis by zooming on the realValue and using the supplied magnification factor. |
static Range<?> |
zoomFromPosition(Axis axis,
double magnificationFactor,
double position)
This method zooms by keeping the given position (for example, the origin) of an axis static |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final double MIN_RESOLUTION
public static final String PROPERTY_TICKS
public static final String PROPERTY_TICK_FONT
public static final String PROPERTY_TICK_LENGTH
public static final String PROPERTY_MINOR_TICK_LENGTH
public static final String PROPERTY_RANGE
public static final String PROPERTY_UPDATE_OTHER_AXES
public static final String PROPERTY_LABEL
public static final String PROPERTY_TICK_LABEL_COLOR
public static final String PROPERTY_TICK_CALCULATOR
public static final String PROPERTY_AXIS_COLOR
public static final String PROPERTY_TICK_COLOR
public static final String PROPERTY_MINOR_TICK_COLOR
public static final String PROPERTY_STROKE
Constructor Detail |
---|
public Axis()
public Axis(String labelText)
labelText
- the text of the labelpublic Axis(AutoPositionedLabel label)
label
- the label to use for the axispublic Axis(double min, double max)
min
- the minimum value of the rangemax
- the maximum value of the rangepublic Axis(Range<?> newRange)
newRange
- the new range of the axispublic Axis(Range<?> newRange, String labelText)
newRange
- the range of the axis, defining minimum and maximum valueslabelText
- the text to use in the label for the axisMethod Detail |
---|
public void addPropertyChangeListener(PropertyChangeListener listener)
listener
- the listener to receive notification of changespublic void removePropertyChangeListener(PropertyChangeListener listener)
listener
- the listenerpublic TickCalculator getTickCalculator()
public void setTickCalculator(TickCalculator tickCalculator)
Specify the tick calculator to use for this axis.
Note: We add ourselves as a PropertyChangeListener to the tick calculator in case there are changes (such as NumberFormatChanges) that require the ticks to be updated.
tickCalculator
- the tick calculatorpublic AxisRenderer getAxisRenderer()
public double getTickLabelRotation()
public void setTickLabelRotation(double tickLabelRotation)
tickLabelRotation
- a rotation given in radianspublic int getTickLabelOffset()
public void setTickLabelOffset(int offset)
offset
- the gap between the tick and the tick labelpublic int getTickLength()
public void setTickLength(int tickLength)
tickLength
- the new length for major tickspublic int getMinorTickLength()
public void setMinorTickLength(int minorTickLength)
minorTickLength
- the new length for minor tickspublic Color getTickColor()
public void setTickColor(Color tickColor)
tickColor
- the color to use when painting ticks on this axispublic Color getMinorTickColor()
public void setMinorTickColor(Color minorTickColor)
minorTickColor
- the Color for minor ticks, or null for the same color as major tickspublic Color getTickLabelColor()
public void setTickLabelColor(Color tickLabelColor)
tickLabelColor
- the color to use for tick labelspublic Font getTickFont()
public void setTickFont(Font tickFont)
tickFont
- the font to use for tick labelspublic boolean isVisible()
public void setVisible(boolean visible)
visible
- true if the axis should be visible; false to make it invisible.public boolean isLabelVisible()
public void setLabelVisible(boolean labelVisible)
Sometimes you might want to specify an axis label, but then set it to be invisible. This can help, for example, when aligning the charts in a multi-chart layout
labelVisible
- whether the label should be visiblepublic Integer getLabelWidth()
public void setLabelWidth(Integer labelWidth)
Use this only to fix the label width at a specific value; otherwise the label width is automatically computed.
labelWidth
- the width of the variable width part of the axis, in pixelspublic int labelWidth(Graphics g, Font tickFont, Orientation orientation, Tick[] ticks)
public int labelWidth(Graphics g, Font tickFont, Orientation orientation)
public void setAxisRenderer(AxisRenderer axisRenderer)
axisRenderer
- the axis rendererpublic void setRange(double min, double max)
min
- the minimum value for the rangemax
- the maximum value for the rangepublic void setRange(Range<?> range)
range
- the new rangepublic void setRange(Range<?> range, boolean updateOtherAxes)
public void setRange(Range<?> range, boolean updateOtherAxes, boolean fireEvent)
public Range<Double> getDomain()
public void setDomain(Range<Double> domain)
public AxisQuantity getQuantity()
public Range<?> getOutputRange()
public Range<?> getRange()
public InvertibleTransform<Double> getAxisTransform()
public void setAxisTransform(InvertibleTransform<Double> axisTransform)
public AutoPositionedLabel getLabel()
public void setLabel(String text)
public void setLabel(AutoPositionedLabel newValue)
public double maximum()
public double minimum()
public double midPoint()
public AxisPlacement getPlacement()
AxisPlacement
public void setPlacement(AxisPlacement placement)
placement
- the placement of the axispublic double getFloatingPosition()
public void setFloatingPosition(double floatingPos)
floatingPos
- the new floating position as a real coordinate valuepublic Color getAxisColor()
public void setAxisColor(Color axisColor)
axisColor
- the color to use for the Axispublic Stroke getStroke()
public void setStroke(Stroke stroke)
stroke
- the stroke to use for the axispublic Tick[] getTicks()
protected void updateTicks()
public boolean isTicksVisible()
public void setTicksVisible(boolean ticksVisible)
ticksVisible
- a boolean value to indicate whether ticks should be visiblepublic boolean isFlipped()
public void setFlipped(boolean flipped)
public static Range<?> zoom(Axis axis, double magnificationFactor)
axis
- the axis to be zoomedmagnificationFactor
- the factor by which we wish to zoom
public static Range<?> zoomFromPosition(Axis axis, double magnificationFactor, double position)
axis
- the axis being zoomedmagnificationFactor
- the magnification factor being applied for the zoom
"param position the position of the zoom along the axis (in terms of user coordinates)
public void render(Graphics g, int x, int y, int length, Orientation orientation)
g
- the Graphics contextx
- the x coordinate for the axisy
- the y coordinate for the axislength
- the length of the axisorientation
- the orientation of the axis; horizontal or verticalpublic String toString()
toString
in class Object
public void propertyChange(PropertyChangeEvent evt)
propertyChange
in interface PropertyChangeListener
public boolean equals(Object o)
equals
in class Object
public int hashCode()
hashCode
in class Object
|
JIDE 3.5.15 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |