|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface IAxis
Interface for an axis of the Chart2D
.
Field Summary | |
---|---|
static String |
PROPERTY_LABELFORMATTER
Constant for a PropertyChangeEvent of the label
formatter. |
static String |
PROPERTY_PAINTGRID
Constant for a of the
paint grid flag. |
static String |
PROPERTY_RANGEPOLICY
Constant for a of the
range policy. |
static String |
PROPERTY_TITLE
Constant for a of the
title String. |
static String |
PROPERTY_TITLEFONT
Constant for a of the
title font. |
static String |
PROPERTY_TITLEPAINTER
Constant for a of the
. |
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. |
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. |
double |
getMajorTickSpacing()
Get the major tick spacing for label generation. |
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 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 used by 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). |
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. |
int |
getWidth(Graphics2D g2d)
Returns the width in pixel this axis needs to paint itself. |
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. |
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. |
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. |
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 that will paint the title of 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 String PROPERTY_PAINTGRID
PropertyChangeEvent
of the
paint grid flag.
static final String PROPERTY_RANGEPOLICY
PropertyChangeEvent
of the
range policy.
static final String PROPERTY_TITLE
PropertyChangeEvent
of the
title String.
static final String PROPERTY_TITLEPAINTER
PropertyChangeEvent
of the
IAxisTitlePainter
.
static final String PROPERTY_TITLEFONT
PropertyChangeEvent
of the
title font.
static final String PROPERTY_LABELFORMATTER
PropertyChangeEvent
of the label
formatter.
Method Detail |
---|
boolean addTrace(ITrace2D trace)
trace
- the trace to add.
boolean removeTrace(ITrace2D trace)
trace
- the trace to remove from this axis.
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.
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.String setTitle(String title)
{IAxisTitlePainter}
of this instance.
title
- the title to set.
null
if there was no title
configured before.setTitlePainter(IAxisTitlePainter)
String getTitle()
null
if there was no title configured
before.
null
if there was no title configured
before.getTitlePainter()
IAxisTitlePainter setTitlePainter(IAxisTitlePainter painter)
painter
- the instance that will paint the title of this axis.
IAxisTitlePainter getTitlePainter()
void addPropertyChangeListener(String propertyName, PropertyChangeListener listener)
The following PropertyChangeEvent
types should be fired
to listeners:
getPropertyName() |
getSource() |
getOldValue() |
getNewValue() |
---|---|---|---|
|
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 or null if there was no
title before. |
, the new value. |
|
that changed |
, the old value or null if
there was no title painter before. |
, the new value. |
|
that changed |
, the old value or null if there
was no title font before. |
, the new value. |
propertyName
- the property to be informed about changes.listener
- the listener that will be informed.AAxis.AChart2DDataAccessor getAccessor()
int getDimension()
Chart2D.X
, Chart2D.Y
or -1 if this axis is not
assigned to a chart.IAxisLabelFormatter getFormatter()
double getMajorTickSpacing()
setMajorTickSpacing(double)
double getMinorTickSpacing()
setMinorTickSpacing(double)
int getWidth(Graphics2D 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 lable, not the complete
space it needs for the complete line.
g2d
- needed for font metric information.
int getHeight(Graphics2D 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.
PropertyChangeListener[] getPropertyChangeListeners(String propertyName)
addPropertyChangeListener(String, PropertyChangeListener)
.
propertyName
- The name of the property being listened to.
addPropertyChangeListener(String, PropertyChangeListener)
.PropertyChangeSupport.getPropertyChangeListeners(java.lang.String)
Range getRange()
Caution: This method does not necessarily return the Range configured with
setRange(Range)
. The internal IRangePolicy
is taken into
account.
setRangePolicy(IRangePolicy)
IRangePolicy getRangePolicy()
AAxis.AChart2DDataAccessor.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.
boolean isPaintGrid()
boolean isPaintScale()
boolean isStartMajorTick()
AAxis.setMajorTickSpacing(double)
void removePropertyChangeListener(String property, 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)
void replace(IAxis axis)
This is used when a new axis is set to a chart.
axis
- the axis to replace by this instance.Chart2D.setAxisX(info.monitorenter.gui.chart.axis.AAxis)
,
Chart2D.setAxisY(info.monitorenter.gui.chart.axis.AAxis)
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 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)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |