| 
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
T - Subtypes may be more picky which scale policies the accept to
          disallow incorrect scales: This supports it (see
          setAxisScalePolicy(IAxisScalePolicy)).public interface IAxis<T extends IAxisScalePolicy>
Interface for an axis of the Chart2D.
 
| Nested Class Summary | |
|---|---|
static class | 
IAxis.AxisTitle
Represents a title of an axis.  | 
| Field Summary | |
|---|---|
static java.lang.String | 
PROPERTY_ADD_REMOVE_TRACE
The bean property constant identifying a change of the
 internal set of  instances. | 
static java.lang.String | 
PROPERTY_AXIS_SCALE_POLICY_CHANGED
The bean property constant identifying a change of the
 axis scale policy. | 
static java.lang.String | 
PROPERTY_LABELFORMATTER
Constant for a  of the
 . | 
static java.lang.String | 
PROPERTY_PAINTGRID
Constant for a  of the
 paint grid flag. | 
static java.lang.String | 
PROPERTY_PAINTSCALE
Constant for a  of the
 paint scale flag. | 
static java.lang.String | 
PROPERTY_RANGEPOLICY
Constant for a  of the
 range policy. | 
| Method Summary | |
|---|---|
 void | 
addPropertyChangeListener(java.lang.String propertyName,
                          java.beans.PropertyChangeListener listener)
Add a listener for the given property.  | 
 boolean | 
addTrace(ITrace2D trace)
Adds a trace that belongs to this axis.  | 
 AAxis.AChart2DDataAccessor | 
getAccessor()
Returns the accessor to the chart.  | 
 int | 
getAxisPosition()
Returns the constant for the position of this axis for the chart.  | 
 IAxisScalePolicy | 
getAxisScalePolicy()
Returns the axis scale policy which controls the position and distance of the ticks to draw.  | 
 IAxis.AxisTitle | 
getAxisTitle()
Returns the title of this axis.  | 
 int | 
getDimension()
Returns the constant for the dimension this axis stands for in the chart.  | 
 java.lang.String | 
getDimensionString()
Returns the String constant for the dimension this axis stands for in the chart.  | 
 IAxisLabelFormatter | 
getFormatter()
Returns the formatter for labels.  | 
 int | 
getHeight(java.awt.Graphics g2d)
Returns the height in pixel this axis needs to paint itself.  | 
 double | 
getMajorTickSpacing()
Get the major tick spacing for label generation.  | 
 double | 
getMax()
Returns the maximum value from all traces of this axis with respect to the installed range policy.  | 
 double | 
getMaxValue()
Returns the maximum value of all  instances in
 all  instances in this axis regardless of the
 configured  (see
 ). | 
 double | 
getMin()
Returns the minimum value of all traces of this axis with respect to the installed range policy.  | 
 double | 
getMinorTickSpacing()
Get the minor tick spacing for label generation.  | 
 double | 
getMinValue()
Returns the minimum value of all  instances in
 all  instances in this axis regardless of the
 configured  (see
 ). | 
 int | 
getPixelXLeft()
Returns the left pixel of this axis coordinate in the graphic context of the current paint operation.  | 
 int | 
getPixelXRight()
Returns the right pixel coordinate of this axis in the graphic context of the current paint operation.  | 
 int | 
getPixelYBottom()
Returns the bottom pixel coordinate of this axis in the graphic context of the current paint operation.  | 
 int | 
getPixelYTop()
Returns the top pixel coordinate of this axis in the graphic context of the current paint operation.  | 
 java.beans.PropertyChangeListener[] | 
getPropertyChangeListeners(java.lang.String propertyName)
Returns an array of all the listeners that were added to the this instance with addPropertyChangeListener(String, PropertyChangeListener). | 
 Range | 
getRange()
Returns the range lasting from  to
 . | 
 IRangePolicy | 
getRangePolicy()
Returns the range policy of this axis.  | 
 double | 
getScaledValue(double absolute)
Scales the given absolute value into a value between 0 and 1.0 (if it is in the range of the data).  | 
 java.lang.String | 
getTitle()
Deprecated. use getAxisTitle() and on the result
             IAxis.AxisTitle.getTitle(). | 
 IAxisTitlePainter | 
getTitlePainter()
Deprecated. this method might be dropped because the painter should be of no concern.  | 
 java.util.Set<ITrace2D> | 
getTraces()
Returns a  with all traces covered by
 this axis. | 
 int | 
getWidth(java.awt.Graphics g2d)
Returns the width in pixel this axis needs to paint itself.  | 
 boolean | 
hasTrace(ITrace2D trace)
Returns true if this axis is responsible for rendering the scale of the given trace (  was called on
 this instance with the given trace). | 
 void | 
initPaintIteration()
Allows to perform expensive calculations for various values that are used by many calls throughout a paint iterations.  | 
 boolean | 
isDirtyScaling()
Returns true if the bounds in the given dimension of all TracePoint2D instances of all internal
 ITrace2D instances have changed since all points have been
 normalized to a value between 0 and 1 or true if this axis has different
 range since the last call to . | 
 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.  | 
 boolean | 
isVisible()
Check whether this axis is visible, i.e.  | 
 void | 
paint(java.awt.Graphics g2d)
Renders the axis line along with title, scale, scale labels and unit label.  | 
 int | 
paintTitle(java.awt.Graphics g2d)
Routine for painting the title of this axis.  | 
 java.util.Set<ITrace2D> | 
removeAllTraces()
Convenience method for removing all contained 
 instances of this axis. | 
 IAxis.AxisTitle | 
removeAxisTitle()
Removes the title of this axis.  | 
 void | 
removePropertyChangeListener(java.lang.String property,
                             java.beans.PropertyChangeListener listener)
Remove a PropertyChangeListener for a specific property.  | 
 boolean | 
removeTrace(ITrace2D trace)
Removes the given trace from this axis.  | 
 void | 
scale()
Scales all  instances in the dimension
 represented by this axis. | 
 void | 
scaleTrace(ITrace2D trace)
Scales the given  in the dimension represented
 by this axis. | 
 IAxisScalePolicy | 
setAxisScalePolicy(T axisScalePolicy)
Sets the axis scale policy which controls the position and distance of the ticks to draw.  | 
 void | 
setAxisTitle(IAxis.AxisTitle axisTitle)
Sets the title of this axis.  | 
 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 | 
setPixelXLeft(int pixel)
Sets a Range to use for filtering the view to the the connected Axis.  | 
 void | 
setPixelXRight(int pixel)
Sets the right pixel of this axis coordinate in the graphic context of the current paint operation.  | 
 void | 
setPixelYBottom(int pixel)
Sets the bottom pixel of this axis coordinate in the graphic context of the current paint operation.  | 
 void | 
setPixelYTop(int pixel)
Sets the top pixel of this axis coordinate in the graphic context of the current paint operation.  | 
 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.  | 
 java.lang.String | 
setTitle(java.lang.String title)
Deprecated. use getAxisTitle() and on the result
             IAxis.AxisTitle.setTitle(String) | 
 IAxisTitlePainter | 
setTitlePainter(IAxisTitlePainter painter)
Deprecated. use getAxisTitle() and on the result
             IAxis.AxisTitle.setTitlePainter(IAxisTitlePainter). | 
 void | 
setVisible(boolean visible)
Show/hide 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.  | 
| Field Detail | 
|---|
static final java.lang.String PROPERTY_ADD_REMOVE_TRACE
constant identifying a change of the
 internal set of ITrace2D instances.
 
 Use this constant to register a PropertyChangeListener
 with the IAxis.
 
 See addPropertyChangeListener(String, PropertyChangeListener)  for property change events fired.
static final java.lang.String PROPERTY_AXIS_SCALE_POLICY_CHANGED
constant identifying a change of the
 axis scale policy. 
 
 Use this constant to register a PropertyChangeListener
 with the IAxis.
 
 See addPropertyChangeListener(String, PropertyChangeListener) for property change events fired.
static final java.lang.String PROPERTY_LABELFORMATTER
PropertyChangeEvent of the
 IAxisTitlePainter.
static final java.lang.String PROPERTY_PAINTGRID
PropertyChangeEvent of the
 paint grid flag.
static final java.lang.String PROPERTY_PAINTSCALE
PropertyChangeEvent of the
 paint scale flag.
static final java.lang.String PROPERTY_RANGEPOLICY
PropertyChangeEvent of the
 range policy.
| Method Detail | 
|---|
void addPropertyChangeListener(java.lang.String propertyName,
                               java.beans.PropertyChangeListener listener)
 The following PropertyChangeEvent types should be fired
 to listeners:
 
getPropertyName() | 
 getSource() | 
 getOldValue() | 
 getNewValue() | 
 
|---|---|---|---|
 
  | 
  that changed | 
 null - a new trace was added. | 
 , the new trace. | 
 
 
  | 
  that changed | 
 , the old trace. | 
 null - the trace was removed. | 
 
 
  | 
  that changed | 
 , the old value. | 
 , the new value. | 
 
  | 
  that changed | 
 , the old value. | 
 , the new value. | 
 
 
  | 
  that changed | 
 , the old value or null if
 there was no formatter before. | 
 , the new value. | 
 
 | 
  that changed | 
 , the old value. | 
 , the new value. | 
 
propertyName - the property to be informed about changes.listener - the listener that will be informed.boolean addTrace(ITrace2D trace)
Adding a trace that is already contained may be problematic, so an exception should be raised in that case to warn you that your code is doing unnecessary to malicious operations.
trace - the trace to add.
AAxis.AChart2DDataAccessor getAccessor()
int getAxisPosition()
Chart2D.CHART_POSITION_LEFT,
         Chart2D.CHART_POSITION_RIGHT,
         Chart2D.CHART_POSITION_TOP,
         Chart2D.CHART_POSITION_BOTTOM or -1 if this axis is not
         assigned to a chart.IAxis.AxisTitle getAxisTitle()
IAxis.AxisTitle removeAxisTitle()
 
 Prefer this method instead of  if you
 want to drop the axis title as this method also "unlistens" this axis from
 it's title.
 getAxisTitle()
int getDimension()
Chart2D.X, Chart2D.Y or -1 if this axis is not
         assigned to a chart.java.lang.String getDimensionString()
null if not assigned to a Chart2D.IAxisLabelFormatter getFormatter()
int getHeight(java.awt.Graphics g2d)
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.
g2d - needed for font metric information.
double getMajorTickSpacing()
setMajorTickSpacing(double)double getMax()
double getMaxValue()
TracePoint2D instances in
 all ITrace2D instances in this axis regardless of the
 configured IRangePolicy (see
 setRangePolicy(IRangePolicy)). The returned
 value is either in x or y dimension - depending on the dimension this axis
 is working in for the chart.
 
         TracePoint2D instances
         in all ITrace2D instances in this axis
         regardless of the configured IRangePolicy (see
         setRangePolicy(IRangePolicy)).double getMin()
double getMinorTickSpacing()
setMinorTickSpacing(double)double getMinValue()
TracePoint2D instances in
 all ITrace2D instances in this axis regardless of the
 configured IRangePolicy (see
 setRangePolicy(IRangePolicy)). The returned
 value is either in x or y dimension - depending on the dimension this axis
 is working in for the chart.
 
         TracePoint2D instances
         in all ITrace2D instances in this axis
         regardless of the configured IRangePolicy (see
         setRangePolicy(IRangePolicy)).int getPixelXLeft()
 Note that this value is only valid throughout a
  invocation.
Chart2D.paint(java.awt.Graphics)
int getPixelXRight()
 Note that this value is only valid throughout a
  invocation.
Chart2D.paint(java.awt.Graphics)
int getPixelYBottom()
 Note that this value is only valid throughout a
  invocation.
Chart2D.paint(java.awt.Graphics)
int getPixelYTop()
 Note that this value is only valid throughout a
  invocation.
Chart2D.paint(java.awt.Graphics)
java.beans.PropertyChangeListener[] getPropertyChangeListeners(java.lang.String propertyName)
addPropertyChangeListener(String, PropertyChangeListener).
 
propertyName - The name of the property being listened to.
addPropertyChangeListener(String, PropertyChangeListener).PropertyChangeSupport.getPropertyChangeListeners(java.lang.String)Range getRange()
getMin() to
 getMax().
 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.
 
setRangePolicy(IRangePolicy)IRangePolicy getRangePolicy()
double getScaledValue(double absolute)
 If the given absolute value is not in the display- range of the
 Chart2D, negative values or values greater than 1.0 may
 result.
 
absolute - a value in the real value range of the corresponding chart.
IAxisScalePolicy getAxisScalePolicy()
IAxisScalePolicy setAxisScalePolicy(T axisScalePolicy)
axisScalePolicy - the axis scale policy which controls the position and distance of
          the ticks to draw to use.
@Deprecated java.lang.String getTitle()
getAxisTitle() and on the result
             IAxis.AxisTitle.getTitle().
null if there was no title configured
 before.
 
null if there was no title configured
         before.getTitlePainter()@Deprecated IAxisTitlePainter getTitlePainter()
java.util.Set<ITrace2D> getTraces()
Set<ITrace2D> with all traces covered by
 this axis.
 
 Caution!
 The original internal modifiable set is returned for performance reasons
 and by contract (to allow removing traces) so do not mess with it to avoid
 ugly unpredictable side effects!
 
Set<ITrace2D> with all traces
         covered by this axis.int getWidth(java.awt.Graphics g2d)
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 label, not the complete space it needs for the complete line.
g2d - needed for font metric information.
boolean hasTrace(ITrace2D trace)
addTrace(ITrace2D) was called on
 this instance with the given trace).
 
trace - the trace to check for containment.
addTrace(ITrace2D) was
         called on this instance with the given trace).void initPaintIteration()
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.
boolean isDirtyScaling()
TracePoint2D instances of all internal
 ITrace2D instances have changed since all points have been
 normalized to a value between 0 and 1 or true if this axis has different
 range since the last call to scale().
 
TracePoint2D instances of all
         internal ITrace2D instances have changed since all points
         have been normalized to a value between 0 and 1 or true if this
         axis has different range since the last call to 
         scale().boolean isPaintGrid()
boolean isPaintScale()
boolean isStartMajorTick()
AAxis.setMajorTickSpacing(double)boolean isVisible()
void paint(java.awt.Graphics g2d)
 This should only be called from , all other
 uses may cause damaged UI or deadlocks.
 Chart2D
g2d - the graphics context to use.int paintTitle(java.awt.Graphics g2d)
 Intended for  only!!!
Chart2D
g2d - needed for painting.
java.util.Set<ITrace2D> removeAllTraces()
ITrace2D
 instances of this axis.
 
 Implementations should fire a
  for the
 PropertyChangeEventPropertyChangeEvent.getPropertyName() for every single trace
 removed. This is done best by delegating this call to several calls to
 PROPERTY_ADD_REMOVE_TRACE.
 removeTrace(ITrace2D)
void removePropertyChangeListener(java.lang.String property,
                                  java.beans.PropertyChangeListener listener)
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.
property - The name of the property that was listened on.listener - The PropertyChangeListener to be removed.PropertyChangeSupport.removePropertyChangeListener(java.lang.String,
      java.beans.PropertyChangeListener)boolean removeTrace(ITrace2D trace)
 A  for the
 PropertyChangeEventPropertyChangeEvent.getPropertyName() has to be fired on the
 registered PROPERTY_ADD_REMOVE_TRACE for the trace
 removed.
 PropertyChangeListener
trace - the trace to remove from this axis.
void scale()
ITrace2D instances in the dimension
 represented by this axis.
 
 This method is not deadlock - safe and should be called by the
  only!
 Chart2D
void scaleTrace(ITrace2D trace)
ITrace2D in the dimension represented
 by this axis.
 
 This method is not deadlock - safe and should be called by the
  only!
 Chart2D
trace - the trace to scale.void setAxisTitle(IAxis.AxisTitle axisTitle)
axisTitle - the axis title to use.void setFormatter(IAxisLabelFormatter formatter)
formatter - The formatter to set.void setMajorTickSpacing(double majorTickSpacing)
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 ).
 
majorTickSpacing - the major tick spacing for label generation.void setMinorTickSpacing(double minorTickSpacing)
The number that is passed-in represents the distance, measured in values, between each minor tick mark. If you have a trace with a range from 0 to 10 and the minor tick spacing is set to 2, you will get major ticks next to the following values: 0, 2, 4, 6, 8, 10. If a major tick hits the same values the tick will be a major ticks. For this example: if a major tick spacing is set to 5 you will only get minor ticks for: 2, 4, 6, 8.
 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 ).
 
minorTickSpacing - the minor tick spacing to set.void setPaintGrid(boolean grid)
A repaint operation for the chart is triggered.
grid - true if the grid should be painted or false if not.void setPaintScale(boolean show)
show - true if the scale on this axis should be shown, false else.void setPixelXLeft(int pixel)
IRangePolicy.
 
 This must only be called from the  itself!
 Chart2D
pixel - the left pixel coordinate of this axis in the graphic context of
          the current paint operation.void setPixelXRight(int pixel)
 This must only be called from the  itself!
 Chart2D
pixel - the right pixel coordinate of this axis in the graphic context of
          the current paint operation.void setPixelYBottom(int pixel)
 This must only be called from the  itself!
 Chart2D
pixel - the bottom pixel coordinate of this axis in the graphic context of
          the current paint operation.void setPixelYTop(int pixel)
 This must only be called from the  itself!
 Chart2D
pixel - the top pixel coordinate of this axis in the graphic context of
          the current paint operation.void setRange(Range range)
IRangePolicy.
 
 To get full control use: 
  setRangePolicy(new <AnARangePolicy>(range);
 
range - Range to use for filtering the view to the the connected Axis.getRangePolicy(), 
IRangePolicy.setRange(Range)void setRangePolicy(IRangePolicy 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.
 
rangePolicy - The rangePolicy to set.void setStartMajorTick(boolean majorTick)
majorTick - true if scale values shall start with a major tick.AAxis.setMajorTickSpacing(double)@Deprecated java.lang.String setTitle(java.lang.String title)
getAxisTitle() and on the result
             IAxis.AxisTitle.setTitle(String)
{IAxisTitlePainter} of this instance.
 
title - the title to set.
null if there was no title
         configured before.setTitlePainter(IAxisTitlePainter)@Deprecated IAxisTitlePainter setTitlePainter(IAxisTitlePainter painter)
getAxisTitle() and on the result
             IAxis.AxisTitle.setTitlePainter(IAxisTitlePainter).
painter - the instance that will paint the title of this axis.
void setVisible(boolean visible)
visible - true to paint axis, false to hide.double translatePxToValue(int pixel)
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.
pixel - a pixel value of the chart component as used by awt.
int translateValueToPx(double value)
value - a chart data value.
  | 
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||