Class AAxis.XDataAccessor
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
AAxisTransformation.XDataAccessor
,AxisInverse.XDataInverseAccessor
- Enclosing class:
AAxis<T extends IAxisScalePolicy>
- Author:
- invalid input: '<'a href="mailto:Achim.Westermann@gmx.de>Achim Westermann
- See Also:
-
Field Summary
Fields inherited from class info.monitorenter.gui.chart.axis.AAxis.AChart2DDataAccessor
m_chart
-
Constructor Summary
ConstructorsConstructorDescriptionXDataAccessor
(Chart2D chart) Creates an instance that accesses the given chart's x axis. -
Method Summary
Modifier and TypeMethodDescriptionint
Returns the constant for the dimension that is accessed on the chart.int
Returns the height in pixel the corresponding axis needs to paint itself.protected final double
Returns the maximum pixels that will be needed to paint a label.protected double
getMaxValue
(ITrace2D trace) Returns the max value of the given trace according to the dimension the outer axis belongs to.final double
Returns the minimum amount of increase in the value that will be needed to display all labels without overwriting each others.protected double
getMinValue
(ITrace2D trace) Returns the min value of the given trace according to the dimension the outer axis belongs to.protected int
Returns the amount of pixel available for displaying the values on the chart in the dimension this accessor stands for.protected double
getValue
(ITracePoint2D point) Returns the value of the given point according to the dimension the outer axis belongs to.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 thisAAxis
.int
Returns the width in pixel the corresponding axis needs to paint itself.protected void
scaleTrace
(ITrace2D trace, Range range) Scales the given trace in the dimension represented by this axis.toString()
Returns "X".final 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 likeMouseEvent.getX()
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 info.monitorenter.gui.chart.axis.AAxis.AChart2DDataAccessor
getChart
-
Constructor Details
-
XDataAccessor
Creates an instance that accesses the given chart's x axis.- Parameters:
chart
- the chart to access.
-
-
Method Details
-
getDimension
public int getDimension()Description copied from class:AAxis.AChart2DDataAccessor
Returns the constant for the dimension that is accessed on the chart.- Specified by:
getDimension
in classAAxis<T extends IAxisScalePolicy>.AChart2DDataAccessor
- Returns:
Chart2D.X
,Chart2D.Y
or -1 if this axis is not assigned to a chart.- See Also:
-
getHeight
Description copied from class:AAxis.AChart2DDataAccessor
Returns the height in pixel the corresponding axis needs to paint itself.This includes the axis line, it's ticks and labels and it's title.
- Specified by:
getHeight
in classAAxis<T extends IAxisScalePolicy>.AChart2DDataAccessor
- Parameters:
g2d
- needed for font metric information.- Returns:
- the height in pixel the corresponding axis needs to paint itself.
- See Also:
-
getMaximumPixelForLabel
Description copied from class:AAxis.AChart2DDataAccessor
Returns the maximum pixels that will be needed to paint a label.- Specified by:
getMaximumPixelForLabel
in classAAxis<T extends IAxisScalePolicy>.AChart2DDataAccessor
- Parameters:
g2d
- provides information about the graphics context to paint on (e.g. font size).- Returns:
- the maximum pixels that will be needed to paint a label.
- See Also:
-
getMaxValue
Description copied from class:AAxis.AChart2DDataAccessor
Returns the max value of the given trace according to the dimension the outer axis belongs to.This is either an x or an y value depending on the dimension the outer axis is working in.
- Specified by:
getMaxValue
in classAAxis<T extends IAxisScalePolicy>.AChart2DDataAccessor
- Parameters:
trace
- the trace to read the maximum of.- Returns:
- the max value of the given trace according to the dimension the outer axis belongs to.
- See Also:
-
getMinimumValueDistanceForLabels
Description copied from class:AAxis.AChart2DDataAccessor
Returns the minimum amount of increase in the value that will be needed to display all labels without overwriting each others.This procedure needs the amount of pixels needed by the largest possible label and relies on the implementation of
AAxis.AChart2DDataAccessor.getMaximumPixelForLabel(Graphics)
, whose result is multiplied with the "value per pixel" quantifier.- Specified by:
getMinimumValueDistanceForLabels
in classAAxis<T extends IAxisScalePolicy>.AChart2DDataAccessor
- Parameters:
g2d
- the current graphic context to use in case further information is required.- Returns:
- the minimum amount of increase in the value that will be needed to display all labels without overwriting each others.
- See Also:
-
getMinValue
Description copied from class:AAxis.AChart2DDataAccessor
Returns the min value of the given trace according to the dimension the outer axis belongs to.This is either an x or an y value depending on the dimension the outer axis is working in.
- Specified by:
getMinValue
in classAAxis<T extends IAxisScalePolicy>.AChart2DDataAccessor
- Parameters:
trace
- the trace to read the maximum of.- Returns:
- the min value of the given trace according to the dimension the outer axis belongs to.
- See Also:
-
getPixelRange
protected int getPixelRange()Description copied from class:AAxis.AChart2DDataAccessor
Returns the amount of pixel available for displaying the values on the chart in the dimension this accessor stands for.This method must not be called within the first lines of a paint cycle (necessary underlying values then are computed new).
- Specified by:
getPixelRange
in classAAxis<T extends IAxisScalePolicy>.AChart2DDataAccessor
- Returns:
- the amount of pixel available for displaying the values on the chart in the dimension this accessor stands for.
- See Also:
-
getValue
Description copied from class:AAxis.AChart2DDataAccessor
Returns the value of the given point according to the dimension the outer axis belongs to.This is either
orITracePoint2D.getX()
.ITracePoint2D.getY()
- Specified by:
getValue
in classAAxis<T extends IAxisScalePolicy>.AChart2DDataAccessor
- Parameters:
point
- the point to read
orITracePoint2D.getX()
from.ITracePoint2D.getY()
- Returns:
- the value of the given point according to the dimension the outer axis belongs to.
- See Also:
-
getValueDistanceForPixel
protected final double getValueDistanceForPixel(int pixel) Description copied from class:AAxis.AChart2DDataAccessor
Returns the value distance on the current chart that exists for the given amount of pixel distance in the given direction of thisAAxis
.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 added
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.- Specified by:
getValueDistanceForPixel
in classAAxis<T extends IAxisScalePolicy>.AChart2DDataAccessor
- Parameters:
pixel
- The desired distance between to scale points 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 coordinates for the scale points of the axis.
- See Also:
-
getWidth
Description copied from class:AAxis.AChart2DDataAccessor
Returns the width in pixel the corresponding axis needs to paint itself.This includes the axis line, it's ticks and labels and it's title.
- Specified by:
getWidth
in classAAxis<T extends IAxisScalePolicy>.AChart2DDataAccessor
- Parameters:
g2d
- needed for font metric information.- Returns:
- the width in pixel the corresponding axis needs to paint itself.
- See Also:
-
scaleTrace
Description copied from class:AAxis.AChart2DDataAccessor
Scales the given trace in the dimension represented by this axis.This method is not deadlock - safe and should be called by the
only!Chart2D
- Specified by:
scaleTrace
in classAAxis<T extends IAxisScalePolicy>.AChart2DDataAccessor
- Parameters:
trace
- the trace to scale.range
- the range to use as scaler.- See Also:
-
toString
Returns "X". -
translateMousePosition
Description copied from class:AAxis.AChart2DDataAccessor
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 this component!
- Specified by:
translateMousePosition
in classAAxis<T extends IAxisScalePolicy>.AChart2DDataAccessor
- 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.
- See Also:
-
translatePxToValue
public double translatePxToValue(int pixel) Description copied from class:AAxis.AChart2DDataAccessor
Transforms the given pixel value (which has to be a awt value likeMouseEvent.getX()
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.
Warning: A value transformed to a pixel by
AAxis.AChart2DDataAccessor.translateValueToPx(double)
and then retransformed byAAxis.AChart2DDataAccessor.translatePxToValue(int)
will most often have changed, as the transformation from value to px a) has to hit an exact int b) most often will map from a bigger domain (value range) to a smaller one (range of chart on the screen).- Specified by:
translatePxToValue
in classAAxis<T extends IAxisScalePolicy>.AChart2DDataAccessor
- 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:
-
translateValueToPx
public int translateValueToPx(double value) Description copied from class:AAxis.AChart2DDataAccessor
Transforms the given chart data value into the corresponding awt pixel value for the chart.The inverse transformation to
AAxis.AChart2DDataAccessor.translatePxToValue(int)
.- Specified by:
translateValueToPx
in classAAxis<T extends IAxisScalePolicy>.AChart2DDataAccessor
- Parameters:
value
- a chart data value.- Returns:
- the awt pixel value corresponding to the chart data value.
- See Also:
-