protected class AAxis.YDataAccessor extends AAxis.AChart2DDataAccessor
Chart2D
.
m_chart
Constructor and Description |
---|
YDataAccessor(Chart2D chart)
Creates an instance that accesses the y axis of the given chart.
|
Modifier and Type | Method and Description |
---|---|
int |
getDimension()
Returns the constant for the dimension that is accessed on the chart.
|
int |
getHeight(Graphics2D g2d)
Returns the height in pixel the corresponding axis needs to paint itself.
|
protected double |
getMaximumPixelForLabel(Graphics2D g2d)
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.
|
double |
getMinimumValueDistanceForLabels(Graphics2D g2d)
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 |
getPixelRange()
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 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
AAxis . |
int |
getWidth(Graphics2D g2d)
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.
|
String |
toString()
Returns "Y".
|
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.getX() into the chart value. |
double |
translatePxToValueRelative(ITracePoint2D point,
int pixel)
Transforms the given relative pixel value into the relative chart value
regarding the point's position.
|
int |
translateValueToPx(double value)
Transforms the given relative value into the relative chart pixel value
regarding the point's position.
|
getChart
public YDataAccessor(Chart2D chart)
chart
- the chart to access.public final int getDimension()
AAxis.AChart2DDataAccessor
getDimension
in class AAxis.AChart2DDataAccessor
Chart2D.X
, Chart2D.Y
or -1 if this axis is not
assigned to a chart.AAxis.AChart2DDataAccessor.getDimension()
public final int getHeight(Graphics2D g2d)
AAxis.AChart2DDataAccessor
This includes the axis line, it's ticks and labels and it's title.
getHeight
in class AAxis.AChart2DDataAccessor
g2d
- needed for font metric information.AAxis.AChart2DDataAccessor.getHeight(Graphics2D)
protected final double getMaximumPixelForLabel(Graphics2D g2d)
AAxis.AChart2DDataAccessor
getMaximumPixelForLabel
in class AAxis.AChart2DDataAccessor
g2d
- the current graphic context to use in case further information
is required.AAxis.AChart2DDataAccessor.getMaximumPixelForLabel(Graphics2D)
protected double getMaxValue(ITrace2D trace)
AAxis.AChart2DDataAccessor
This is either an x or an y value depending on the dimension the outer axis is working in.
getMaxValue
in class AAxis.AChart2DDataAccessor
trace
- the trace to read the maximum of.AAxis.AChart2DDataAccessor.getMaxValue(info.monitorenter.gui.chart.ITrace2D)
public final double getMinimumValueDistanceForLabels(Graphics2D g2d)
AAxis.AChart2DDataAccessor
This procedure needs the amount of pixels needed by the largest possible
label and relies on the implementation of
AAxis.AChart2DDataAccessor.getMaximumPixelForLabel(Graphics2D)
, whose result is multiplied
with the "value per pixel" quantifier.
getMinimumValueDistanceForLabels
in class AAxis.AChart2DDataAccessor
g2d
- the current graphic context to use in case further information
is required.AAxis.AChart2DDataAccessor.getMinimumValueDistanceForLabels(Graphics2D)
protected double getMinValue(ITrace2D trace)
AAxis.AChart2DDataAccessor
This is either an x or an y value depending on the dimension the outer axis is working in.
getMinValue
in class AAxis.AChart2DDataAccessor
trace
- the trace to read the maximum of.AAxis.AChart2DDataAccessor.getMinValue(info.monitorenter.gui.chart.ITrace2D)
protected final int getPixelRange()
AAxis.AChart2DDataAccessor
This method must not be called within the first lines of a paint cycle (necessary underlying values then are computed new).
getPixelRange
in class AAxis.AChart2DDataAccessor
AAxis.AChart2DDataAccessor.getPixelRange()
protected double getValue(ITracePoint2D point)
AAxis.AChart2DDataAccessor
This is either
or
ITracePoint2D.getX()
.
ITracePoint2D.getY()
getValue
in class AAxis.AChart2DDataAccessor
point
- the point to read ITracePoint2D.getX()
or
ITracePoint2D.getY()
from.AAxis.AChart2DDataAccessor.getValue(info.monitorenter.gui.chart.ITracePoint2D)
protected final double getValueDistanceForPixel(int pixel)
AAxis.AChart2DDataAccessor
AAxis
.
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.
getValueDistanceForPixel
in class AAxis.AChart2DDataAccessor
pixel
- The desired distance between to scale points of the x- axis in
pixel.AAxis.AChart2DDataAccessor.getValueDistanceForPixel(int)
public final int getWidth(Graphics2D g2d)
AAxis.AChart2DDataAccessor
This includes the axis line, it's ticks and labels and it's title.
getWidth
in class AAxis.AChart2DDataAccessor
g2d
- needed for font metric information.AAxis.AChart2DDataAccessor.getWidth(Graphics2D)
protected void scaleTrace(ITrace2D trace, Range range)
AAxis.AChart2DDataAccessor
This method is not deadlock - safe and should be called by the
only!
Chart2D
scaleTrace
in class AAxis.AChart2DDataAccessor
trace
- the trace to scale.range
- the range to use as scaler.AAxis.AChart2DDataAccessor.scaleTrace(info.monitorenter.gui.chart.ITrace2D,
info.monitorenter.util.Range)
public double translateMousePosition(MouseEvent mouseEvent)
AAxis.AChart2DDataAccessor
Note that the mouse event has to be an event fired on this component!
translateMousePosition
in class AAxis.AChart2DDataAccessor
mouseEvent
- a mouse event that has been fired on this component.AAxis.AChart2DDataAccessor.translateMousePosition(java.awt.event.MouseEvent)
public double translatePxToValue(int pixel)
AAxis.AChart2DDataAccessor
MouseEvent.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 by
AAxis.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).
translatePxToValue
in class AAxis.AChart2DDataAccessor
pixel
- a pixel value of the chart component as used by awt.AAxis.AChart2DDataAccessor.translatePxToValue(int)
public double translatePxToValueRelative(ITracePoint2D point, int pixel)
AAxis.AChart2DDataAccessor
This must only be used when the chart dimensions (
Chart2D.getXChartEnd()
, Chart2D.getXChartStart()
, ...)
are already computed and valid.
translatePxToValueRelative
in class AAxis.AChart2DDataAccessor
point
- the point to relate to (origin of the relative distance).pixel
- a relative pixel value of the chart component as used by awt.AAxis.AChart2DDataAccessor.translatePxToValueRelative(info.monitorenter.gui.chart.ITracePoint2D,
int)
public int translateValueToPx(double value)
AAxis.AChart2DDataAccessor
This must only be used when the chart dimensions (
Chart2D.getXChartEnd()
, Chart2D.getXChartStart()
, ...)
are already computed and valid.
translateValueToPx
in class AAxis.AChart2DDataAccessor
value
- a relative pixel value of the chart component as used by awt.AAxis.AChart2DDataAccessor.translateValueToPx(double)
Copyright © 2018. All rights reserved.