info.monitorenter.gui.chart.axis
Class AAxis

java.lang.Object
  extended by info.monitorenter.gui.chart.axis.AAxis
All Implemented Interfaces:
IAxis, PropertyChangeListener, Serializable, EventListener
Direct Known Subclasses:
AAxisTransformation, AxisInverse, AxisLinear

public abstract class AAxis
extends Object
implements IAxis, PropertyChangeListener

The base class for an axis of the Chart2D.

Normally - as the design and interaction of an Axis with the Chart2DD is very fine-grained - it is not instantiated by users of jchart2d: It is automatically instantiated by the constructor of Chart2D. It then may be retrieved from the Chart2D by the methods Chart2D.getAxisX() and Chart2D.getAxisY() for further configuration.

Version:
$Revision: 1.33 $
Author:
Achim Westermann
See Also:
Serialized Form

Nested Class Summary
 class AAxis.AChart2DDataAccessor
          An internal connector class that will connect the axis to the a Chart2D.
 class AAxis.XDataAccessor
          An accessor for the x axis of a chart.
 class AAxis.YDataAccessor
          Accesses the y axis of the Chart2D.
 
Field Summary
protected  AAxis.AChart2DDataAccessor m_accessor
          The accessor to the Chart2D.
protected  IAxisLabelFormatter m_formatter
          Formatting of the labels.
protected  double m_majorTickSpacing
          The major tick spacing for label generations.
protected  double m_minorTickSpacing
          The minor tick spacing for label generations.
protected  double m_power
          Internally used for rouding to ticks, calculated once per paint iteration.
 
Fields inherited from interface info.monitorenter.gui.chart.IAxis
PROPERTY_LABELFORMATTER, PROPERTY_PAINTGRID, PROPERTY_RANGEPOLICY, PROPERTY_TITLE, PROPERTY_TITLEFONT, PROPERTY_TITLEPAINTER
 
Constructor Summary
AAxis()
          Default constructor that uses a LabelFormatterAutoUnits for formatting labels.
AAxis(IAxisLabelFormatter formatter)
          Constructor that uses the given label formatter for formatting labels.
 
Method Summary
 void addPropertyChangeListener(String propertyName, PropertyChangeListener listener)
          Add a listener for the given property.
 boolean addTrace(ITrace2D trace)
          Adds a trace that belongs to this axis.
protected abstract  AAxis.AChart2DDataAccessor createAccessor(Chart2D chart, int dimension)
          Template method to create the proper AAxis.AChart2DDataAccessor implementation.
 AAxis.AChart2DDataAccessor getAccessor()
          Returns the accessor to the chart.
 int getDimension()
          Returns the constant for the dimension this axis stands for in the chart.
 IAxisLabelFormatter getFormatter()
          Returns the formatter for labels.
 int getHeight(Graphics2D g2d)
          Returns the height in pixel this axis needs to paint itself.
protected  LabeledValue[] getLabels(double resolution)
          Returns the labels for this axis.
 double getMajorTickSpacing()
          Get the major tick spacing for label generation.
 double getMax()
          The maximum value access method for the Axis this instance is aggregated to.
 double getMin()
          Returns the minimum value access method for the Axis this instance is aggregated to.
 double getMinorTickSpacing()
          Get the minor tick spacing for label generation.
 PropertyChangeListener[] getPropertyChangeListeners(String propertyName)
          Returns an array of all the listeners that were added to the this instance with IAxis.addPropertyChangeListener(String, PropertyChangeListener).
 Range getRange()
          This method is used by the Chart2D to scale it's values during painting.
 IRangePolicy getRangePolicy()
          Returns the range policy of this axis.
 LabeledValue[] getScaleValues(Graphics g2d)
          Returns the array of labeled values that will be used by the Chart2D to paint labels.
 String getTitle()
          Returns the title or null if there was no title configured before.
 IAxisTitlePainter getTitlePainter()
          Returns the instance that will paint the title of this axis.
protected  double getValueDistanceForPixel(int pixel)
          Returns the value distance on the current chart that exists for the given amount of pixel distance in the given direction of this Axis.
 int getWidth(Graphics2D g2d)
          Returns the width in pixel this axis needs to paint itself.
 void initPaintIteration()
          Perfomres expensive calculations for various values that are used by many calls throughout a paint iterations.
 boolean isPaintGrid()
          Returns wether the x grid is painted or not.
 boolean isPaintScale()
          Returns whether the scale for this axis should be painted or not.
 boolean isStartMajorTick()
          Check wether scale values are started from major ticks.
 int paintTitle(Graphics2D g2d)
          Routine for painting the title of this axis.
 void propertyChange(PropertyChangeEvent evt)
           
 void removePropertyChangeListener(String property, PropertyChangeListener listener)
          Remove a PropertyChangeListener for a specific property.
 boolean removeTrace(ITrace2D trace)
          Removes the given trace from this axis.
 void replace(IAxis axis)
          Copies the complete state (flat, references are overtaken) of the given axis to this instance and overtakes any property change listeners.
protected  LabeledValue roundToTicks(double value, boolean floor, boolean findMajorTick)
          Internal rounding routine.
 void scale()
          Scales all ITrace2D instances in the dimension represented by this axis.
 void scaleTrace(ITrace2D trace)
          Scales the given ITrace2D in the dimension represented by this axis.
protected  void setAccessor(AAxis.AChart2DDataAccessor accessor)
          Sets the accessor to the axis of the chart.
 void setChart(Chart2D chart, int dimension)
          Allows the chart to register itself with the axix.
 void setFormatter(IAxisLabelFormatter formatter)
          Sets the formatter to use for labels.
 void setMajorTickSpacing(double majorTickSpacing)
          This method sets the major tick spacing for label generation.
 void setMinorTickSpacing(double minorTickSpacing)
          This method sets the minor tick spacing for label generation.
 void setPaintGrid(boolean grid)
          Set wether the grid in this dimension should be painted or not.
 void setPaintScale(boolean show)
          Set if the scale for this axis should be shown.
 void setRange(Range range)
           Sets a Range to use for filtering the view to the the connected Axis.
 void setRangePolicy(IRangePolicy rangePolicy)
           Sets the RangePolicy.
 void setStartMajorTick(boolean majorTick)
          Set wether scale values are started from major ticks.
 String setTitle(String title)
          Sets the title of this axis will be painted by the {IAxisTitlePainter} of this instance.
 IAxisTitlePainter setTitlePainter(IAxisTitlePainter painter)
          Sets the title painter of this axis which is by default AxisTitlePainterDefault.
 double translateMousePosition(MouseEvent mouseEvent)
          Returns the translation of the mouse event coordinates of the given mouse event to the value within the chart for the dimension (x,y) covered by this axis.
 double translatePxToValue(int pixel)
          Transforms the given pixel value (which has to be a awt value like MouseEvent.getY() into the chart value.
 int translateValueToPx(double value)
          Transforms the given chart data value into the corresponding awt pixel value for the chart.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface info.monitorenter.gui.chart.IAxis
getScaledValue
 

Field Detail

m_accessor

protected AAxis.AChart2DDataAccessor m_accessor
The accessor to the Chart2D.

It determines, which axis (x or y) this instance is representing.


m_formatter

protected IAxisLabelFormatter m_formatter
Formatting of the labels.


m_majorTickSpacing

protected double m_majorTickSpacing
The major tick spacing for label generations.

See Also:
setMajorTickSpacing(double)

m_minorTickSpacing

protected double m_minorTickSpacing
The minor tick spacing for label generations.

See Also:
setMinorTickSpacing(double)

m_power

protected double m_power
Internally used for rouding to ticks, calculated once per paint iteration.

Constructor Detail

AAxis

public AAxis()
Default constructor that uses a LabelFormatterAutoUnits for formatting labels.


AAxis

public AAxis(IAxisLabelFormatter formatter)
Constructor that uses the given label formatter for formatting labels.

Parameters:
formatter - needed for formatting labels of this axis.
Method Detail

propertyChange

public final void propertyChange(PropertyChangeEvent evt)
Specified by:
propertyChange in interface PropertyChangeListener
See Also:
PropertyChangeListener.propertyChange(java.beans.PropertyChangeEvent)

addTrace

public boolean addTrace(ITrace2D trace)
Description copied from interface: IAxis
Adds a trace that belongs to this axis.

Specified by:
addTrace in interface IAxis
Parameters:
trace - the trace to add.
Returns:
true if the trace was added, false else.
See Also:
IAxis.addTrace(info.monitorenter.gui.chart.ITrace2D)

removeTrace

public boolean removeTrace(ITrace2D trace)
Description copied from interface: IAxis
Removes the given trace from this axis.

Specified by:
removeTrace in interface IAxis
Parameters:
trace - the trace to remove from this axis.
Returns:
true if the given trace could be removed from this axis, false else.
See Also:
IAxis.removeTrace(info.monitorenter.gui.chart.ITrace2D)

addPropertyChangeListener

public void addPropertyChangeListener(String propertyName,
                                      PropertyChangeListener listener)
Description copied from interface: IAxis
Add a listener for the given property.

The following PropertyChangeEvent types should be fired to listeners:

getPropertyName() getSource() getOldValue() getNewValue()
IAxis.PROPERTY_RANGEPOLICY IAxis that changed IRangePolicy, the old value. IRangePolicy, the new value.
IAxis.PROPERTY_PAINTGRID IAxis that changed Boolean, the old value. Boolean, the new value.
IAxis.PROPERTY_LABELFORMATTER IAxis that changed IAxisLabelFormatter, the old value or null if there was no formatter before. IAxisLabelFormatter, the new value.
IAxis.PROPERTY_TITLE IAxis that changed String, the old value or null if there was no title before. String, the new value.
IAxis.PROPERTY_TITLEPAINTER IAxis that changed IAxisTitlePainter, the old value or null if there was no title painter before. IAxisTitlePainter, the new value.
IAxis.PROPERTY_TITLEFONT IAxis that changed Font, the old value or null if there was no title font before. Font, the new value.

Specified by:
addPropertyChangeListener in interface IAxis
Parameters:
propertyName - the property to be informed about changes.
listener - the listener that will be informed.
See Also:
IAxis.addPropertyChangeListener(java.lang.String, java.beans.PropertyChangeListener)

createAccessor

protected abstract AAxis.AChart2DDataAccessor createAccessor(Chart2D chart,
                                                             int dimension)
Template method to create the proper AAxis.AChart2DDataAccessor implementation.

Parameters:
chart - the chart to access.
dimension - Chart2D.X or Chart2D.Y.
Returns:
the proper AAxis.AChart2DDataAccessor implementation.

getAccessor

public AAxis.AChart2DDataAccessor getAccessor()
Returns the accessor to the chart.

Specified by:
getAccessor in interface IAxis
Returns:
the accessor to the chart.

getDimension

public int getDimension()
Description copied from interface: IAxis
Returns the constant for the dimension this axis stands for in the chart.

Specified by:
getDimension in interface IAxis
Returns:
Chart2D.X, Chart2D.Y or -1 if this axis is not assigned to a chart.
See Also:
IAxis.getDimension()

getFormatter

public final IAxisLabelFormatter getFormatter()
Description copied from interface: IAxis
Returns the formatter for labels.

Specified by:
getFormatter in interface IAxis
Returns:
Returns the formatter.

getHeight

public final int getHeight(Graphics2D g2d)
Description copied from interface: IAxis
Returns the height in pixel this axis needs to paint itself.

This includes the axis line, it's ticks and labels and it's title.

Note:
For an y axis the hight only includes the overhang it needs on the upper edge for painting a complete lable, not the complete space it needs for the complete line.

Specified by:
getHeight in interface IAxis
Parameters:
g2d - needed for font metric information.
Returns:
the height in pixel this axis needs to paint itself.
See Also:
IAxis.getHeight(java.awt.Graphics2D)

getLabels

protected LabeledValue[] getLabels(double resolution)
Returns the labels for this axis.

The labels will have at least the given argument resolution as distance in the value domain of the chart.

Parameters:
resolution - the distance in the value domain of the chart that has to be at least between to labels.
Returns:
the labels for this axis.

getMajorTickSpacing

public double getMajorTickSpacing()
Description copied from interface: IAxis
Get the major tick spacing for label generation.

Specified by:
getMajorTickSpacing in interface IAxis
Returns:
the major tick spacing for label generation.
See Also:
IAxis.getMajorTickSpacing()

getMax

public double getMax()
The maximum value access method for the Axis this instance is aggregated to.

It supports the retrieval of data from the corrcet dimension of the connected Chart2 (X or Y) as well as the respect to the configured IRangePolicy.

Returns:
the maximum value access method for the Axis this instance is aggregated to.

getMin

public double getMin()
Returns the minimum value access method for the Axis this instance is aggregated to.

It supports the retrieval of data from the corrcet dimension of the connected Chart2 (X or Y) as well as the respect to the configured IRangePolicy.

Returns:
the minimum value access method for the Axis this instance is aggregated to.

getMinorTickSpacing

public double getMinorTickSpacing()
Get the minor tick spacing for label generation.

Specified by:
getMinorTickSpacing in interface IAxis
Returns:
he minor tick spacing for label generation.
See Also:
setMinorTickSpacing(double)

getPropertyChangeListeners

public PropertyChangeListener[] getPropertyChangeListeners(String propertyName)
Description copied from interface: IAxis
Returns an array of all the listeners that were added to the this instance with IAxis.addPropertyChangeListener(String, PropertyChangeListener).

Specified by:
getPropertyChangeListeners in interface IAxis
Parameters:
propertyName - The name of the property being listened to.
Returns:
an array of all the listeners that were added to the this instance with IAxis.addPropertyChangeListener(String, PropertyChangeListener).
See Also:
IAxis.getPropertyChangeListeners(java.lang.String)

getRange

public final Range getRange()
This method is used by the Chart2D to scale it's values during painting.

Caution: This method does not necessarily return the Range configured with setRange(Range). The internal IRangePolicy is taken into account.

Specified by:
getRange in interface IAxis
Returns:
the range corresponding to the upper and lower bound of the values that will be displayable on this Axis of the Chart2D.
See Also:
setRangePolicy(IRangePolicy)

getRangePolicy

public IRangePolicy getRangePolicy()
Returns the range policy of this axis.

Specified by:
getRangePolicy in interface IAxis
Returns:
the range policy of this axis.
See Also:
AAxis.AChart2DDataAccessor.getRangePolicy()

getScaleValues

public LabeledValue[] getScaleValues(Graphics g2d)
Returns the array of labeled values that will be used by the Chart2D to paint labels.

Parameters:
g2d - Provides information about the graphic context (e.g. font metrics).
Returns:
the array of labeled values that will be used by the Chart2D to paint labels.

getTitle

public final String getTitle()
Description copied from interface: IAxis
Returns the title or null if there was no title configured before.

Specified by:
getTitle in interface IAxis
Returns:
the title or null if there was no title configured before.
See Also:
IAxis.getTitle()

getTitlePainter

public final IAxisTitlePainter getTitlePainter()
Description copied from interface: IAxis
Returns the instance that will paint the title of this axis.

Specified by:
getTitlePainter in interface IAxis
Returns:
the instance that will paint the title of this axis.
See Also:
IAxis.getTitlePainter()

getValueDistanceForPixel

protected final double getValueDistanceForPixel(int pixel)
Returns the value distance on the current chart that exists for the given amount of pixel distance in the given direction of this Axis.

Depending on the width of the actual Chart2D and the contained values, the relation between displayed distances (pixel) and value distances (the values of the addes ITrace2D instances changes.

This method calculates depending on the actual painting area of the Chart2D, the shift in value between two points that have a screen distance of the given pixel.
This method is not used by the chart itself but a helper for outside use.

Parameters:
pixel - The desired distance between to scalepoints of the x- axis in pixel.
Returns:
a scaled (from pixel to internal value-range) and normed (to the factor of the current unit of the axis) value usable to calculate the coords for the scalepoints of the axis.

getWidth

public final int getWidth(Graphics2D g2d)
Description copied from interface: IAxis
Returns the width in pixel this axis needs to paint itself.

This includes the axis line, it's ticks and labels and it's title.

Note:
For an x axis the width only includes the overhang it needs on the right edge for painting a complete lable, not the complete space it needs for the complete line.

Specified by:
getWidth in interface IAxis
Parameters:
g2d - needed for font metric information.
Returns:
the width in pixel this axis needs to paint itself.
See Also:
IAxis.getWidth(java.awt.Graphics2D)

initPaintIteration

public void initPaintIteration()
Perfomres expensive calculations for various values that are used by many calls throughout a paint iterations.

These values are constant throughout a paint iteration by the contract that no point is added removed or changed in this period. Because these values are used from many methods it is impossible to calculate them at a "transparent" method that may perform this caching over a paint period without knowledge from outside. The first method called in a paint iteration is called several further times in the iteration. So this is the common hook to invoke before painting a chart.


isPaintGrid

public final boolean isPaintGrid()
Returns wether the x grid is painted or not.

Specified by:
isPaintGrid in interface IAxis
Returns:
wether the x grid is painted or not.

isPaintScale

public final boolean isPaintScale()
Returns whether the scale for this axis should be painted or not.

Specified by:
isPaintScale in interface IAxis
Returns:
whether the scale for this axis should be painted or not.

isStartMajorTick

public boolean isStartMajorTick()
Check wether scale values are started from major ticks.

Specified by:
isStartMajorTick in interface IAxis
Returns:
true if scale values start from major ticks.
See Also:
setMajorTickSpacing(double)

paintTitle

public int paintTitle(Graphics2D g2d)
Routine for painting the title of this axis.

Intended for Chart2D only!!!

Parameters:
g2d - needed for painting.
Returns:
the width consumed in px for y axis, the height consumed in px for x axis.

removePropertyChangeListener

public void removePropertyChangeListener(String property,
                                         PropertyChangeListener listener)
Description copied from interface: IAxis
Remove a PropertyChangeListener for a specific property. If listener was added more than once to the same event source for the specified property, it will be notified one less time after being removed. If propertyName is null, no exception is thrown and no action is taken. If listener is null, or was never added for the specified property, no exception is thrown and no action is taken.

Specified by:
removePropertyChangeListener in interface IAxis
Parameters:
property - The name of the property that was listened on.
listener - The PropertyChangeListener to be removed.
See Also:
IAxis.removePropertyChangeListener(java.lang.String, java.beans.PropertyChangeListener)

replace

public void replace(IAxis axis)
Description copied from interface: IAxis
Copies the complete state (flat, references are overtaken) of the given axis to this instance and overtakes any property change listeners.

This is used when a new axis is set to a chart.

Specified by:
replace in interface IAxis
Parameters:
axis - the axis to replace by this instance.
See Also:
IAxis.replace(info.monitorenter.gui.chart.IAxis)

roundToTicks

protected LabeledValue roundToTicks(double value,
                                    boolean floor,
                                    boolean findMajorTick)
Internal rounding routine.

Arguments are not chosen to be "understandable" or "usable" but optimized for performance.

The findMajorTick argument may be used e.g. to force labels to start from a major tick.

Parameters:
value - the value to round.
floor - if true, rounding goes to floor else to ceiling.
findMajorTick - if true the returned value will be a major tick (which might be fare more away from the given value than the next major tick).
Returns:
the value rounded to minor or major ticks.

scale

public void scale()
Description copied from interface: IAxis
Scales all ITrace2D instances in the dimension represented by this axis.

This method is not deadlock - safe and should be called by the Chart2D only!

Specified by:
scale in interface IAxis
See Also:
IAxis.scale()

scaleTrace

public void scaleTrace(ITrace2D trace)
Description copied from interface: IAxis
Scales the given ITrace2D in the dimension represented by this axis.

This method is not deadlock - safe and should be called by the Chart2D only!

Specified by:
scaleTrace in interface IAxis
Parameters:
trace - the trace to scale.
See Also:
IAxis.scaleTrace(info.monitorenter.gui.chart.ITrace2D)

setAccessor

protected final void setAccessor(AAxis.AChart2DDataAccessor accessor)
Sets the accessor to the axis of the chart.

Parameters:
accessor - the accessor to the axis of the chart.

setChart

public void setChart(Chart2D chart,
                     int dimension)
Allows the chart to register itself with the axix.

This is intended for Chart2D only!.

Parameters:
chart - the chart to register itself with this axis.
dimension - Chart2D.X or Chart2D.Y.

setFormatter

public void setFormatter(IAxisLabelFormatter formatter)
Sets the formatter to use for labels.

Specified by:
setFormatter in interface IAxis
Parameters:
formatter - The formatter to set.

setMajorTickSpacing

public void setMajorTickSpacing(double majorTickSpacing)
This method sets the major tick spacing for label generation.

Only values between 0.0 and 100.0 are allowed.

The number that is passed-in represents the distance, measured in values, between each major tick mark. If you have a trace with a range from 0 to 50 and the major tick spacing is set to 10, you will get major ticks next to the following values: 0, 10, 20, 30, 40, 50.

Note:
Ticks are free of any multiples of 1000. If the chart contains values between 0 an 1000 and configured a tick of 2 the values 0, 200, 400, 600, 800 and 1000 will highly probable to be displayed. This depends on the size (in pixels) of the Chart2D<. Of course there is a difference: ticks are used in divisions and multiplications: If the internal values are very low and the ticks are very high, huge rounding errors might occur (division by ticks results in very low values a double cannot hit exactly. So prefer setting ticks between 0 an 10 or - if you know your values are very small (e.g. in nano range [10 -9 ]) use a small value (e.g. 2*10 -9 ).

Specified by:
setMajorTickSpacing in interface IAxis
Parameters:
majorTickSpacing - the major tick spacing for label generation.

setMinorTickSpacing

public void setMinorTickSpacing(double minorTickSpacing)
This method sets the minor tick spacing for label generation.

The number that is passed-in represents the distance, measured in values, between each major tick mark. If you have a trace with a range from 0 to 50 and the major tick spacing is set to 10, you will get major ticks next to the following values: 0, 10, 20, 30, 40, 50.

Note:
Ticks are free of any powers of 10. There is no difference between setting a tick to 2, 200 or 20000 because ticks cannot break the rule that every scale label has to be visible. If the chart contains values between 0 an 1000 and configured a tick of 2 the values 0, 200, 400, 600, 800 and 1000 will highly probable to be displayed. This depends on the size (in pixels) of the Chart2D<. Of course there is a difference: ticks are used in divisions and multiplications: If the internal values are very low and the ticks are very high, huge rounding errors might occur (division by ticks results in very low values a double cannot hit exactly. So prefer setting ticks between 0 an 10 or - if you know your values are very small (e.g. in nano range [10 -9 ]) use a small value (e.g. 2*10 -9 ).

Specified by:
setMinorTickSpacing in interface IAxis
Parameters:
minorTickSpacing - the minor tick spacing to set.

setPaintGrid

public final void setPaintGrid(boolean grid)
Set wether the grid in this dimension should be painted or not.

If the grid is set to show (argument is true) also the painting of the scale labels (setPaintScale(boolean) is turned on. This implicit behaviour is chosen as it seems senseless to have gridlines without knowing which value they stand for.

Specified by:
setPaintGrid in interface IAxis
Parameters:
grid - true if the grid should be painted or false if not.

setPaintScale

public final void setPaintScale(boolean show)
Set if the scale for this axis should be shown.

Specified by:
setPaintScale in interface IAxis
Parameters:
show - true if the scale on this axis should be shown, false else.

setRange

public final void setRange(Range range)

Sets a Range to use for filtering the view to the the connected Axis. Note that it's effect will be affected by the internal IRangePolicy.

To get full control use:
setRangePolicy(new <AnARangePolicy>(range);

Specified by:
setRange in interface IAxis
Parameters:
range - Range to use for filtering the view to the the connected Axis.
See Also:
getRangePolicy(), IRangePolicy.setRange(Range)

setRangePolicy

public void setRangePolicy(IRangePolicy rangePolicy)

Sets the RangePolicy.

If the given RangePolicy has an unconfigured internal Range ( Range.RANGE_UNBOUNDED) the old internal RangePolicy is taken into account:
If the old RangePolicy has a configured Range this is transferred to the new RangePolicy.

A property change event for IAxis.PROPERTY_RANGEPOLICY is fired and receives listeners if a change took place.

Specified by:
setRangePolicy in interface IAxis
Parameters:
rangePolicy - The rangePolicy to set.

setStartMajorTick

public void setStartMajorTick(boolean majorTick)
Set wether scale values are started from major ticks.

Specified by:
setStartMajorTick in interface IAxis
Parameters:
majorTick - true if scale values shall start with a major tick.
See Also:
setMajorTickSpacing(double)

setTitle

public final String setTitle(String title)
Description copied from interface: IAxis
Sets the title of this axis will be painted by the {IAxisTitlePainter} of this instance.

Specified by:
setTitle in interface IAxis
Parameters:
title - the title to set.
Returns:
the previous Title or null if there was no title configured before.
See Also:
IAxis.setTitle(String)

setTitlePainter

public final IAxisTitlePainter setTitlePainter(IAxisTitlePainter painter)
Sets the title painter of this axis which is by default AxisTitlePainterDefault.

Specified by:
setTitlePainter in interface IAxis
Parameters:
painter - the instance that will paint the title of this axis.
Returns:
the previous title painter of this axis or null if there was none configured before.
See Also:
IAxis.setTitlePainter(info.monitorenter.gui.chart.IAxisTitlePainter)

translateMousePosition

public double translateMousePosition(MouseEvent mouseEvent)
                              throws IllegalArgumentException
Returns the translation of the mouse event coordinates of the given mouse event to the value within the chart for the dimension (x,y) covered by this axis.

Note that the mouse event has to be an event fired on the correspondinig chart component!

Parameters:
mouseEvent - a mouse event that has been fired on this component.
Returns:
the translation of the mouse event coordinates of the given mouse event to the value within the chart for the dimension covered by this axis (x or y) or null if no calculations could be performed as the chart was not painted before.
Throws:
IllegalArgumentException - if the given mouse event is out of the current graphics context (not a mouse event of the chart component).

translatePxToValue

public double translatePxToValue(int pixel)
Description copied from interface: IAxis
Transforms the given pixel value (which has to be a awt value like MouseEvent.getY() into the chart value.

Internal use only, the interface does not guarantee that the pixel corresponds to any valid awt pixel value within the chart component.

Specified by:
translatePxToValue in interface IAxis
Parameters:
pixel - a pixel value of the chart component as used by awt.
Returns:
the awt pixel value transformed to the chart value.
See Also:
IAxis.translatePxToValue(int)

translateValueToPx

public int translateValueToPx(double value)
Description copied from interface: IAxis
Transforms the given chart data value into the corresponding awt pixel value for the chart.

Specified by:
translateValueToPx in interface IAxis
Parameters:
value - a chart data value.
Returns:
the awt pixel value corresponding to the chart data value.
See Also:
IAxis.translateValueToPx(double)


Copyright © 2001 - 2007 LGPL, All Rights Footloose.