|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object info.monitorenter.gui.chart.axis.AAxis<T>
T
- Subtypes may be more picky which scale policies the accept to
disallow incorrect scales: This supports it (see
IAxis.setAxisScalePolicy(IAxisScalePolicy)
).public abstract class AAxis<T extends IAxisScalePolicy>
The base class for an axis of the
.
Chart2D
Normally - as the design and interaction of an Axis
with the
is very fine-grained - it is not instantiated
by users of jchart2d: It is automatically instantiated by the constructor of
Chart2D
DChart2D
. It then may be retrieved from the Chart2D
by the methods Chart2D.getAxisX()
and Chart2D.getAxisY()
for
further configuration.
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. |
protected class |
AAxis.YDataAccessor
Accesses the y axis of the Chart2D . |
Nested classes/interfaces inherited from interface info.monitorenter.gui.chart.IAxis |
---|
IAxis.AxisTitle |
Field Summary | |
---|---|
static boolean |
DEBUG
Debugging flag for sysouts. |
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_max
The current maximum value for all points in all traces. |
protected double |
m_min
The current minimum value for all points in all traces. |
protected double |
m_minorTickSpacing
The minor tick spacing for label generations. |
protected boolean |
m_needsFullRescale
Flag to detect if a re-scaling has to be done. |
protected IRangePolicy |
m_rangePolicy
A plugable range policy. |
Fields inherited from interface info.monitorenter.gui.chart.IAxis |
---|
PROPERTY_ADD_REMOVE_TRACE, PROPERTY_AXIS_SCALE_POLICY_CHANGED, PROPERTY_LABELFORMATTER, PROPERTY_PAINTGRID, PROPERTY_PAINTSCALE, PROPERTY_RANGEPOLICY |
Constructor Summary | |
---|---|
AAxis()
Default constructor that uses a LabelFormatterAutoUnits for
formatting labels. |
|
AAxis(IAxisLabelFormatter formatter,
T scalePolicy)
Constructor that uses the given label formatter for formatting labels. |
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. |
protected abstract AAxis.AChart2DDataAccessor |
createAccessor(Chart2D chart,
int dimension,
int position)
Template method to create the proper
implementation. |
protected void |
ensureInitialized()
Ensures that no deadlock / NPE due to a missing internal chart reference may occur. |
boolean |
equals(java.lang.Object obj)
|
protected double |
findMax()
Searches for the maximum value of all contained ITraces in the dimension this axis stands for. |
protected double |
findMin()
Searches for the minimum value of all contained ITraces in the dimension this axis stands for. |
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 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. |
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. |
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(java.awt.Graphics g2d)
Returns the width in pixel this axis needs to paint itself. |
int |
hashCode()
|
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()
Performs 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 whether the x grid is painted or not. |
boolean |
isPaintScale()
Returns whether the scale for this axis should be painted or not. |
boolean |
isStartMajorTick()
Check whether scale values are started from major ticks. |
boolean |
isVisible()
Check if 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. |
void |
propertyChange(java.beans.PropertyChangeEvent evt)
Receives all from all instances
the chart registers itself as a
. |
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. |
protected void |
scalePoint(ITracePoint2D point)
Internally rescales the given in the
dimension this axis works in. |
void |
scaleTrace(ITrace2D trace)
Scales the given in the dimension represented
by this axis. |
protected void |
setAccessor(AAxis.AChart2DDataAccessor accessor)
Sets the accessor to the axis of the chart. |
protected void |
setAxisPosition(int axisPosition)
Sets the axisPosition. |
IAxisScalePolicy |
setAxisScalePolicy(T axisScalePolicy)
The default used is . |
void |
setAxisTitle(IAxis.AxisTitle axisTitle)
Sets the title of this axis. |
void |
setChart(Chart2D chart,
int dimension,
int position)
Callback that allows the chart to register itself with the axis when the axis is added to the chart. |
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 whether 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 pixelXLeft)
Sets a Range to use for filtering the view to the the connected Axis. |
void |
setPixelXRight(int pixelXRight)
Sets the right pixel of this axis coordinate in the graphic context of the current paint operation. |
void |
setPixelYBottom(int pixelYBottom)
Sets the bottom pixel of this axis coordinate in the graphic context of the current paint operation. |
void |
setPixelYTop(int pixelYTop)
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)
instead. |
void |
setVisible(boolean visible)
Set the visibility of this axis. |
double |
translateMousePosition(java.awt.event.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, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface info.monitorenter.gui.chart.IAxis |
---|
getScaledValue |
Field Detail |
---|
public static final boolean DEBUG
protected AAxis.AChart2DDataAccessor m_accessor
It determines, which axis (x or y) this instance is representing.
protected IAxisLabelFormatter m_formatter
protected double m_majorTickSpacing
setMajorTickSpacing(double)
protected double m_max
protected double m_min
protected double m_minorTickSpacing
setMinorTickSpacing(double)
protected boolean m_needsFullRescale
It is set to false in
which is triggered from
the painting Thread. Whenever a bound change is detected in
scale()
this is set to
true.
propertyChange(PropertyChangeEvent)
Please remind: In previous versions there was only a test if the bounds had changed since the last scaling. This was not always correct: If in between two paint cycles the bounds were changed and new points added but at the point in time when the 2nd paint cycle starts the bounds would be equal no full rescaling would be performed even if the added points would have been scaled in relation to the changed bounds at their adding time: Bounds checks are not sufficient!
protected IRangePolicy m_rangePolicy
Constructor Detail |
---|
public AAxis()
LabelFormatterAutoUnits
for
formatting labels.
public AAxis(IAxisLabelFormatter formatter, T scalePolicy)
formatter
- needed for formatting labels of this axis.scalePolicy
- controls the ticks/labels and their distance.Method Detail |
---|
public IAxisScalePolicy getAxisScalePolicy()
IAxis
getAxisScalePolicy
in interface IAxis<T extends IAxisScalePolicy>
IAxis.getAxisScalePolicy()
public IAxisScalePolicy setAxisScalePolicy(T axisScalePolicy)
AxisScalePolicyAutomaticBestFit
.
setAxisScalePolicy
in interface IAxis<T extends IAxisScalePolicy>
axisScalePolicy
- the axis scale policy which controls the position and distance of
the ticks to draw to use.
IAxis.setAxisScalePolicy(info.monitorenter.gui.chart.IAxisScalePolicy)
public java.lang.String getDimensionString()
IAxis
getDimensionString
in interface IAxis<T extends IAxisScalePolicy>
null
if not assigned to a Chart2D
.IAxis.getDimensionString()
public void addPropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)
IAxis
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. |
addPropertyChangeListener
in interface IAxis<T extends IAxisScalePolicy>
propertyName
- the property to be informed about changes.listener
- the listener that will be informed.IAxis.addPropertyChangeListener(java.lang.String,
java.beans.PropertyChangeListener)
public boolean addTrace(ITrace2D trace)
IAxis
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.
addTrace
in interface IAxis<T extends IAxisScalePolicy>
trace
- the trace to add.
IAxis.addTrace(info.monitorenter.gui.chart.ITrace2D)
protected abstract AAxis.AChart2DDataAccessor createAccessor(Chart2D chart, int dimension, int position)
AAxis.AChart2DDataAccessor
implementation.
chart
- the chart to access.dimension
- Chart2D.X
or Chart2D.Y
.position
- Chart2D.CHART_POSITION_BOTTOM
,
Chart2D.CHART_POSITION_LEFT
,
Chart2D.CHART_POSITION_RIGHT
or
Chart2D.CHART_POSITION_TOP
.
AAxis.AChart2DDataAccessor
implementation.public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
Object.equals(java.lang.Object)
protected final double findMax()
This method is triggered when a trace fired a property change for property
or
ITrace2D.PROPERTY_MAX_X
with a value lower than the
internal stored maximum.
ITrace2D.PROPERTY_MAX_Y
Performance breakdown is avoided because all ITrace2D
implementations cache their max and min values.
protected final double findMin()
This method is triggered when a trace fired a property change for property
or
ITrace2D.PROPERTY_MAX_X
with a value lower than the
internal stored minimum.
ITrace2D.PROPERTY_MAX_Y
Performance breakdown is avoided because all ITrace2D
implementations cache their max and min values.
public AAxis.AChart2DDataAccessor getAccessor()
getAccessor
in interface IAxis<T extends IAxisScalePolicy>
public int getAxisPosition()
IAxis
getAxisPosition
in interface IAxis<T extends IAxisScalePolicy>
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.getAxisPosition()
public IAxis.AxisTitle getAxisTitle()
IAxis
getAxisTitle
in interface IAxis<T extends IAxisScalePolicy>
IAxis.getAxisTitle()
public int getDimension()
IAxis
getDimension
in interface IAxis<T extends IAxisScalePolicy>
Chart2D.X
, Chart2D.Y
or -1 if this axis is not
assigned to a chart.IAxis.getDimension()
public final IAxisLabelFormatter getFormatter()
IAxis
getFormatter
in interface IAxis<T extends IAxisScalePolicy>
public final int getHeight(java.awt.Graphics g2d)
IAxis
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.
getHeight
in interface IAxis<T extends IAxisScalePolicy>
g2d
- needed for font metric information.
IAxis.getHeight(java.awt.Graphics)
public double getMajorTickSpacing()
IAxis
getMajorTickSpacing
in interface IAxis<T extends IAxisScalePolicy>
IAxis.getMajorTickSpacing()
public double getMax()
IAxis
getMax
in interface IAxis<T extends IAxisScalePolicy>
IAxis.getMax()
public double getMaxValue()
IAxis
TracePoint2D
instances in
all ITrace2D
instances in this axis regardless of the
configured IRangePolicy
(see
IAxis.setRangePolicy(IRangePolicy)
). The returned
value is either in x or y dimension - depending on the dimension this axis
is working in for the chart.
getMaxValue
in interface IAxis<T extends IAxisScalePolicy>
TracePoint2D
instances
in all ITrace2D
instances in this axis
regardless of the configured IRangePolicy
(see
IAxis.setRangePolicy(IRangePolicy)
).IAxis.getMaxValue()
public double getMin()
IAxis
getMin
in interface IAxis<T extends IAxisScalePolicy>
IAxis.getMin()
public double getMinorTickSpacing()
getMinorTickSpacing
in interface IAxis<T extends IAxisScalePolicy>
setMinorTickSpacing(double)
public double getMinValue()
IAxis
TracePoint2D
instances in
all ITrace2D
instances in this axis regardless of the
configured IRangePolicy
(see
IAxis.setRangePolicy(IRangePolicy)
). The returned
value is either in x or y dimension - depending on the dimension this axis
is working in for the chart.
getMinValue
in interface IAxis<T extends IAxisScalePolicy>
TracePoint2D
instances
in all ITrace2D
instances in this axis
regardless of the configured IRangePolicy
(see
IAxis.setRangePolicy(IRangePolicy)
).IAxis.getMinValue()
public final int getPixelXLeft()
IAxis
Note that this value is only valid throughout a
invocation.
Chart2D.paint(java.awt.Graphics)
getPixelXLeft
in interface IAxis<T extends IAxisScalePolicy>
IAxis.getPixelXLeft()
public final int getPixelXRight()
IAxis
Note that this value is only valid throughout a
invocation.
Chart2D.paint(java.awt.Graphics)
getPixelXRight
in interface IAxis<T extends IAxisScalePolicy>
IAxis.getPixelXRight()
public final int getPixelYBottom()
IAxis
Note that this value is only valid throughout a
invocation.
Chart2D.paint(java.awt.Graphics)
getPixelYBottom
in interface IAxis<T extends IAxisScalePolicy>
IAxis.getPixelYBottom()
public final int getPixelYTop()
IAxis
Note that this value is only valid throughout a
invocation.
Chart2D.paint(java.awt.Graphics)
getPixelYTop
in interface IAxis<T extends IAxisScalePolicy>
IAxis.getPixelYTop()
public java.beans.PropertyChangeListener[] getPropertyChangeListeners(java.lang.String propertyName)
IAxis
IAxis.addPropertyChangeListener(String, PropertyChangeListener)
.
getPropertyChangeListeners
in interface IAxis<T extends IAxisScalePolicy>
propertyName
- The name of the property being listened to.
IAxis.addPropertyChangeListener(String, PropertyChangeListener)
.IAxis.getPropertyChangeListeners(java.lang.String)
public final Range getRange()
Caution: This method does not necessarily return the Range configured with
setRange(Range)
. The internal IRangePolicy
is taken into
account.
getRange
in interface IAxis<T extends IAxisScalePolicy>
setRangePolicy(IRangePolicy)
public IRangePolicy getRangePolicy()
getRangePolicy
in interface IAxis<T extends IAxisScalePolicy>
@Deprecated public final java.lang.String getTitle()
getAxisTitle()
and on the result
IAxis.AxisTitle#getTitle()
.
IAxis
null
if there was no title configured
before.
getTitle
in interface IAxis<T extends IAxisScalePolicy>
null
if there was no title configured
before.IAxis.getTitlePainter()
@Deprecated public final IAxisTitlePainter getTitlePainter()
IAxis
getTitlePainter
in interface IAxis<T extends IAxisScalePolicy>
IAxis.getTitlePainter()
public java.util.Set<ITrace2D> getTraces()
IAxis
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!
getTraces
in interface IAxis<T extends IAxisScalePolicy>
Set
<ITrace2D
>
with all traces
covered by this axis.IAxis.getTraces()
protected final double getValueDistanceForPixel(int pixel)
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
instances
changes.
ITrace2D
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.
pixel
- The desired distance between to scalepoints of the x- axis in
pixel.
public final int getWidth(java.awt.Graphics g2d)
IAxis
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.
getWidth
in interface IAxis<T extends IAxisScalePolicy>
g2d
- needed for font metric information.
IAxis.getWidth(java.awt.Graphics)
public int hashCode()
hashCode
in class java.lang.Object
Object.hashCode()
public final boolean hasTrace(ITrace2D trace)
IAxis
IAxis.addTrace(ITrace2D)
was called on
this instance with the given trace).
hasTrace
in interface IAxis<T extends IAxisScalePolicy>
trace
- the trace to check for containment.
IAxis.addTrace(ITrace2D)
was
called on this instance with the given trace).IAxis.hasTrace(info.monitorenter.gui.chart.ITrace2D)
public 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.
initPaintIteration
in interface IAxis<T extends IAxisScalePolicy>
public final boolean isDirtyScaling()
IAxis
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 IAxis.scale()
.
isDirtyScaling
in interface IAxis<T extends IAxisScalePolicy>
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
IAxis.scale()
.IAxis.isDirtyScaling()
public final boolean isPaintGrid()
isPaintGrid
in interface IAxis<T extends IAxisScalePolicy>
public final boolean isPaintScale()
isPaintScale
in interface IAxis<T extends IAxisScalePolicy>
public boolean isStartMajorTick()
isStartMajorTick
in interface IAxis<T extends IAxisScalePolicy>
setMajorTickSpacing(double)
public boolean isVisible()
isVisible
in interface IAxis<T extends IAxisScalePolicy>
public void paint(java.awt.Graphics g2d)
IAxis
This should only be called from
, all other
uses may cause damaged UI or deadlocks.
Chart2D
paint
in interface IAxis<T extends IAxisScalePolicy>
g2d
- the graphics context to use.IAxis.paint(java.awt.Graphics)
public int paintTitle(java.awt.Graphics g2d)
IAxis
Intended for
only!!!
Chart2D
paintTitle
in interface IAxis<T extends IAxisScalePolicy>
g2d
- needed for painting.
IAxis.paintTitle(java.awt.Graphics)
public void propertyChange(java.beans.PropertyChangeEvent evt)
PropertyChangeEvent
from all instances
the chart registers itself as a PropertyChangeListener
.
propertyChange
in interface java.beans.PropertyChangeListener
evt
- the property change event that was fired.PropertyChangeListener.propertyChange(java.beans.PropertyChangeEvent)
public final java.util.Set<ITrace2D> removeAllTraces()
IAxis
ITrace2D
instances of this axis.
Implementations should fire a
for the
PropertyChangeEvent
PropertyChangeEvent.getPropertyName()
for every single trace
removed. This is done best by delegating this call to several calls to
IAxis.PROPERTY_ADD_REMOVE_TRACE
.
IAxis.removeTrace(ITrace2D)
removeAllTraces
in interface IAxis<T extends IAxisScalePolicy>
IAxis.removeAllTraces()
public IAxis.AxisTitle removeAxisTitle()
IAxis
Prefer this method instead of
if you
want to drop the axis title as this method also "unlistens" this axis from
it's title.
IAxis.getAxisTitle()
removeAxisTitle
in interface IAxis<T extends IAxisScalePolicy>
IAxis.removeAxisTitle()
public void removePropertyChangeListener(java.lang.String property, java.beans.PropertyChangeListener listener)
IAxis
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.
removePropertyChangeListener
in interface IAxis<T extends IAxisScalePolicy>
property
- The name of the property that was listened on.listener
- The PropertyChangeListener to be removed.IAxis.removePropertyChangeListener(java.lang.String,
java.beans.PropertyChangeListener)
public boolean removeTrace(ITrace2D trace)
IAxis
A
for the
PropertyChangeEvent
PropertyChangeEvent.getPropertyName()
has to be fired on the
registered IAxis.PROPERTY_ADD_REMOVE_TRACE
for the trace
removed.
PropertyChangeListener
removeTrace
in interface IAxis<T extends IAxisScalePolicy>
trace
- the trace to remove from this axis.
IAxis.removeTrace(info.monitorenter.gui.chart.ITrace2D)
protected final void scalePoint(ITracePoint2D point)
ITracePoint2D
in the
dimension this axis works in.
point
- the point to scale (between 0.0 and 1.0) according to the internal
bounds.public void scale()
IAxis
ITrace2D
instances in the dimension
represented by this axis.
This method is not deadlock - safe and should be called by the
only!
Chart2D
scale
in interface IAxis<T extends IAxisScalePolicy>
IAxis.scale()
public void scaleTrace(ITrace2D trace)
IAxis
ITrace2D
in the dimension represented
by this axis.
This method is not deadlock - safe and should be called by the
only!
Chart2D
scaleTrace
in interface IAxis<T extends IAxisScalePolicy>
trace
- the trace to scale.IAxis.scaleTrace(info.monitorenter.gui.chart.ITrace2D)
protected final void setAccessor(AAxis.AChart2DDataAccessor accessor)
accessor
- the accessor to the axis of the chart.protected final void setAxisPosition(int axisPosition)
axisPosition
- 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.public void setAxisTitle(IAxis.AxisTitle axisTitle)
IAxis
setAxisTitle
in interface IAxis<T extends IAxisScalePolicy>
axisTitle
- the axis title to use.IAxis.setAxisTitle(info.monitorenter.gui.chart.IAxis.AxisTitle)
public void setChart(Chart2D chart, int dimension, int position)
This is intended for Chart2D
only!.
Please do not use this from anywhere in your code. It allows to
chart
- the chart to register itself with this axis.dimension
- Chart2D.X
or Chart2D.Y
.position
- Chart2D.CHART_POSITION_BOTTOM
,
Chart2D.CHART_POSITION_LEFT
,
Chart2D.CHART_POSITION_RIGHT
or
Chart2D.CHART_POSITION_TOP
.public void setFormatter(IAxisLabelFormatter formatter)
setFormatter
in interface IAxis<T extends IAxisScalePolicy>
formatter
- The formatter to set.public 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 ).
setMajorTickSpacing
in interface IAxis<T extends IAxisScalePolicy>
majorTickSpacing
- the major tick spacing for label generation.public void setMinorTickSpacing(double minorTickSpacing)
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 ).
setMinorTickSpacing
in interface IAxis<T extends IAxisScalePolicy>
minorTickSpacing
- the minor tick spacing to set.public final void setPaintGrid(boolean grid)
setPaintGrid
in interface IAxis<T extends IAxisScalePolicy>
grid
- true if the grid should be painted or false if not.public final void setPaintScale(boolean show)
setPaintScale
in interface IAxis<T extends IAxisScalePolicy>
show
- true if the scale on this axis should be shown, false else.public final void setPixelXLeft(int pixelXLeft)
IAxis
IRangePolicy
.
This must only be called from the
itself!
Chart2D
setPixelXLeft
in interface IAxis<T extends IAxisScalePolicy>
pixelXLeft
- the left pixel coordinate of this axis in the graphic context of
the current paint operation.IAxis.setPixelXLeft(int)
public final void setPixelXRight(int pixelXRight)
IAxis
This must only be called from the
itself!
Chart2D
setPixelXRight
in interface IAxis<T extends IAxisScalePolicy>
pixelXRight
- the right pixel coordinate of this axis in the graphic context of
the current paint operation.IAxis.setPixelXRight(int)
public final void setPixelYBottom(int pixelYBottom)
IAxis
This must only be called from the
itself!
Chart2D
setPixelYBottom
in interface IAxis<T extends IAxisScalePolicy>
pixelYBottom
- the bottom pixel coordinate of this axis in the graphic context of
the current paint operation.IAxis.setPixelYBottom(int)
public final void setPixelYTop(int pixelYTop)
IAxis
This must only be called from the
itself!
Chart2D
setPixelYTop
in interface IAxis<T extends IAxisScalePolicy>
pixelYTop
- the top pixel coordinate of this axis in the graphic context of
the current paint operation.IAxis.setPixelYTop(int)
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);
setRange
in interface IAxis<T extends IAxisScalePolicy>
range
- Range to use for filtering the view to the the connected Axis.getRangePolicy()
,
IRangePolicy.setRange(Range)
protected final void ensureInitialized()
java.lang.IllegalStateException
- if this axis is not assigned to a chart.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.
IAxis.PROPERTY_RANGEPOLICY
is fired and
receives listeners if a change took place.
setRangePolicy
in interface IAxis<T extends IAxisScalePolicy>
rangePolicy
- The rangePolicy to set.public void setStartMajorTick(boolean majorTick)
setStartMajorTick
in interface IAxis<T extends IAxisScalePolicy>
majorTick
- true if scale values shall start with a major tick.setMajorTickSpacing(double)
@Deprecated public final java.lang.String setTitle(java.lang.String title)
getAxisTitle()
and on the result
IAxis.AxisTitle#setTitle(String)
IAxis
{IAxisTitlePainter}
of this instance.
setTitle
in interface IAxis<T extends IAxisScalePolicy>
title
- the title to set.
null
if there was no title
configured before.IAxis.setTitlePainter(IAxisTitlePainter)
@Deprecated public final IAxisTitlePainter setTitlePainter(IAxisTitlePainter painter)
getAxisTitle()
and on the result
IAxis.AxisTitle#setTitlePainter(IAxisTitlePainter)
instead.
AxisTitlePainterDefault
.
setTitlePainter
in interface IAxis<T extends IAxisScalePolicy>
painter
- the instance that will paint the title of this axis.
public void setVisible(boolean visible)
setVisible
in interface IAxis<T extends IAxisScalePolicy>
visible
- true to show, false to hidepublic double translateMousePosition(java.awt.event.MouseEvent mouseEvent) throws java.lang.IllegalArgumentException
Note that the mouse event has to be an event fired on the correspondinig chart component!
mouseEvent
- a mouse event that has been fired on this component.
java.lang.IllegalArgumentException
- if the given mouse event is out of the current graphics context
(not a mouse event of the chart component).public double translatePxToValue(int pixel)
IAxis
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.
translatePxToValue
in interface IAxis<T extends IAxisScalePolicy>
pixel
- a pixel value of the chart component as used by awt.
IAxis.translatePxToValue(int)
public final int translateValueToPx(double value)
IAxis
translateValueToPx
in interface IAxis<T extends IAxisScalePolicy>
value
- a chart data value.
IAxis.translateValueToPx(double)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |