|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object info.monitorenter.gui.chart.axis.scalepolicy.AxisScalePolicyAutomaticBestFit
public class AxisScalePolicyAutomaticBestFit
Very basic and fast scale policy implementation that ensures the following:
Field Summary | |
---|---|
protected double |
m_power
Internally used for rounding to ticks, calculated once per paint iteration. |
Constructor Summary | |
---|---|
AxisScalePolicyAutomaticBestFit()
|
Method Summary | |
---|---|
protected java.util.List<LabeledValue> |
getLabels(double resolution,
IAxis<?> axis)
Returns the labels for this axis. |
java.util.List<LabeledValue> |
getScaleValues(java.awt.Graphics g2d,
IAxis<?> axis)
Returns the array of labeled values that will be used by the to paint labels. |
void |
initPaintIteration(IAxis<?> axis)
Performs expensive calculations for various values that are used by many calls throughout a paint iterations. |
protected LabeledValue |
roundToTicks(double value,
boolean floor,
boolean findMajorTick,
IAxis<?> axis)
Internal rounding routine. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected double m_power
Constructor Detail |
---|
public AxisScalePolicyAutomaticBestFit()
Method Detail |
---|
public java.util.List<LabeledValue> getScaleValues(java.awt.Graphics g2d, IAxis<?> axis)
IAxisScalePolicy
Chart2D
to paint labels.
getScaleValues
in interface IAxisScalePolicy
g2d
- Provides information about the graphic context (e.g. font
metrics).axis
- the axis to work for.
Chart2D
to paint labels.public void initPaintIteration(IAxis<?> axis)
IAxisScalePolicy
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 IAxisScalePolicy
axis
- the axis to read data from.IAxisScalePolicy.initPaintIteration(info.monitorenter.gui.chart.IAxis)
protected java.util.List<LabeledValue> getLabels(double resolution, IAxis<?> axis)
The labels will have at least the given argument resolution
as
distance in the value domain of the chart.
resolution
- the distance in the value domain of the chart that has to be at
least between to labels.
protected LabeledValue roundToTicks(double value, boolean floor, boolean findMajorTick, IAxis<?> axis)
Arguments are not chosen to be "understandable" or "usable" but optimized for performance.
The findMajorTick
argument may be used e.g. to force labels
to start from a major tick.
value
- the value to round.floor
- if true, rounding goes to floor else to ceiling.findMajorTick
- if true the returned value will be a major tick (which might be
fare more away from the given value than the next major tick).
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |