org.eclipse.birt.chart.computation.withaxes
Class AutoScale

java.lang.Object
  extended by org.eclipse.birt.chart.computation.Methods
      extended by org.eclipse.birt.chart.computation.withaxes.AutoScale
All Implemented Interfaces:
java.lang.Cloneable, IConstants

public final class AutoScale
extends Methods
implements java.lang.Cloneable

Encapsulates the auto scaling algorithms used by the rendering and chart computation framework.


Field Summary
 
Fields inherited from interface org.eclipse.birt.chart.computation.IConstants
ABOVE, ANCILLARY_AXIS, ANCILLARY_BASE, AUTO, AVERAGE, AXIS, BACKWARD, BASE, BASE_AXIS, BELOW, BOTTOM, CENTER, COLLECTION, DATE_TIME, DESIGN_TIME, EMPTY_STRING, EQUAL, FORWARD, HORIZONTAL, INSIDE, LABELS, LEFT, LEGEND_ENTRY, LEGEND_MINSLICE_ENTRY, LEGEND_SEPERATOR, LESS, LINE_EXPAND_DOUBLE_SIZE, LINE_EXPAND_SIZE, LINEAR, LOG_10, LOGARITHMIC, MAJOR, MAX, MIN, MINOR, MORE, NON_PRIMITIVE_ARRAY, NULL_STRING, NUMERICAL, ONE_SPACE, ORTHOGONAL, ORTHOGONAL_AXIS, OTHER, OUTSIDE, PERCENT, POSITION_MASK, POSITION_MOVE_ABOVE, POSITION_MOVE_BELOW, POSITION_MOVE_LEFT, POSITION_MOVE_RIGHT, PRIMITIVE_ARRAY, RIGHT, RUN_TIME, SOME_NULL, TEXT, THREE_D, TICK_ABOVE, TICK_ACROSS, TICK_BELOW, TICK_LEFT, TICK_NONE, TICK_RIGHT, TICK_SIDE1, TICK_SIDE2, TICK_SIZE, TOP, TWO_5_D, TWO_D, UNDEFINED, UNDEFINED_STRING, USER_INTERFACE, VALUE, VERTICAL
 
Constructor Summary
AutoScale(int _iType, java.lang.Object _oMinimum, java.lang.Object _oMaximum)
          The constructor.
 
Method Summary
 boolean checkFit(IDisplayServer xs, Label la, int iLabelLocation)
          Checks all labels for any overlap for a given axis' scale
 java.lang.Object clone()
           
 double computeAxisLabelThickness(IDisplayServer xs, Label la, int iOrientation)
           
 com.ibm.icu.text.DecimalFormat computeDecimalFormat(double dAxisValue, double dAxisStep)
          Computes the default DecimalFormat pattern for axis according to axis value and scale steps.
 double computeStaggeredAxisLabelOffset(IDisplayServer xs, Label la, int iOrientation)
           
 int computeTicks(IDisplayServer xs, Label la, int iLabelLocation, int iOrientation, double dStart, double dEnd, boolean bConsiderStartEndLabels, AllAxes aax)
           
 int computeTicks(IDisplayServer xs, Label la, int iLabelLocation, int iOrientation, double dStart, double dEnd, boolean bConsiderStartLabel, boolean bConsiderEndLabel, AllAxes aax)
           
 java.lang.String formatCategoryValue(int iType, java.lang.Object oValue, int iDateTimeUnit)
          Returns the formatted value for given Axis type and value.
 java.lang.String getComputedLabelText(int index)
           
 DataSetIterator getData()
           
 int getDirection()
          Returns the scale direction.
 double getEnd()
           
 double[] getEndPoints()
           
 FormatSpecifier getFormatSpecifier()
           
 java.lang.Object getMaximum()
           
 java.lang.Object getMinimum()
           
 double[] getMinorCoordinates(int iMinorUnitsPerMajor)
           
 double getNormalizedEnd()
          Returns the normalized end point.
 double[] getNormalizedEndPoints()
          Returns the normalized start and end point.
 double getNormalizedStart()
          Returns the normalized start point.
 java.lang.String getNumericPattern()
          Returns an auto computed decimal format pattern for representing axis labels on a numeric axis
 RunTimeContext getRunTimeContext()
           
 double getStart()
           
 java.lang.Object getStep()
           
 java.lang.Integer getStepNumber()
           
 AxisTickCoordinates getTickCordinates()
           
 int getTickCount()
          Computes tick count
 int getType()
           
 java.lang.Object getUnit()
           
 double getUnitSize()
          Returns the absolute value of the scale unit.
 boolean isAxisLabelStaggered()
           
 boolean isCategoryScale()
          Checks if axis is category style or Text type
 boolean isMaximumFixed()
           
 boolean isMinimumFixed()
           
 boolean isStepFixed()
           
 boolean isTickBetweenCategories()
           
 boolean isTickLabelStaggered(int index)
           
 boolean isTickLabelVisible(int index)
           
 void setData(DataSetIterator _oaData)
           
 void setDirection(int iValue)
          Sets the scale direction.
 void setFormatSpecifier(FormatSpecifier fs)
           
 void setMaximum(java.lang.Object o)
           
 void setMaximumFixed(boolean v)
           
 void setMinimum(java.lang.Object o)
           
 void setMinimumFixed(boolean v)
           
static void setNumberMinMaxToScale(AutoScale sc, java.lang.Object oMinimum, java.lang.Object oMaximum, RunTimeContext rtc, OneAxis ax)
          Updates AutoScale by checking min or max
 void setRunTimeContext(RunTimeContext context)
           
 void setStep(java.lang.Object o)
           
 void setStepFixed(boolean v)
           
 void setStepNumber(java.lang.Integer o)
           
static void setStepToScale(AutoScale sc, java.lang.Object oStep, java.lang.Integer oStepNumber, RunTimeContext rtc)
          Updates AutoScale by checking step size and step number
 void updateAxisMinMax(java.lang.Object oMinValue, java.lang.Object oMaxValue)
          Computes min, max value, step size and step number of the Axis
 boolean zoomIn()
          Zooms IN 'once' into a scale of type numerical or datetime Typically, this is called in a loop until label overlaps occur
 boolean zoomOut()
          Zooms OUT 'once' into a scale of type numerical or datetime Typically, this is called in a loop until label overlaps occur
 
Methods inherited from class org.eclipse.birt.chart.computation.Methods
asDateTime, asDouble, asInteger, computeBox, computeBox, computeHeight, computePolygon, computeRotatedTopPoint, computeWidth, getLabelPosition, getLocation, getLocation, getLocation, getNormalizedLocation, getNormalizedLocation, limitDataPointLabelLocation
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AutoScale

public AutoScale(int _iType,
                 java.lang.Object _oMinimum,
                 java.lang.Object _oMaximum)
The constructor.

Parameters:
_iType -
_oMinimum -
_oMaximum -
_oStep -
Method Detail

setDirection

public final void setDirection(int iValue)
Sets the scale direction.

Parameters:
val -

getDirection

public int getDirection()
Returns the scale direction.

Returns:

clone

public final java.lang.Object clone()
Overrides:
clone in class java.lang.Object

zoomIn

public final boolean zoomIn()
Zooms IN 'once' into a scale of type numerical or datetime Typically, this is called in a loop until label overlaps occur


zoomOut

public final boolean zoomOut()
Zooms OUT 'once' into a scale of type numerical or datetime Typically, this is called in a loop until label overlaps occur


getNumericPattern

public final java.lang.String getNumericPattern()
Returns an auto computed decimal format pattern for representing axis labels on a numeric axis

Returns:

getType

public final int getType()
Returns:

setData

public final void setData(DataSetIterator _oaData)
Parameters:
_oaData -

getFormatSpecifier

public final FormatSpecifier getFormatSpecifier()
Returns:

setFormatSpecifier

public final void setFormatSpecifier(FormatSpecifier fs)
Parameters:
fs -

getUnit

public final java.lang.Object getUnit()
Returns:

getData

public final DataSetIterator getData()
Returns:

isTickLabelVisible

public final boolean isTickLabelVisible(int index)
Parameters:
index -
Returns:

getComputedLabelText

public final java.lang.String getComputedLabelText(int index)

isTickLabelStaggered

public final boolean isTickLabelStaggered(int index)
Parameters:
index -
Returns:

isAxisLabelStaggered

public final boolean isAxisLabelStaggered()
Returns:

isTickBetweenCategories

public final boolean isTickBetweenCategories()
Returns:

getTickCordinates

public final AxisTickCoordinates getTickCordinates()
Returns:

getNormalizedStart

public final double getNormalizedStart()
Returns the normalized start point. always be Zero.

Returns:

getNormalizedEnd

public final double getNormalizedEnd()
Returns the normalized end point. this will be the (orginal end - orginal start).

Returns:

getNormalizedEndPoints

public final double[] getNormalizedEndPoints()
Returns the normalized start and end point.

Returns:

getEndPoints

public final double[] getEndPoints()
Returns:

getTickCount

public final int getTickCount()
                       throws ChartException
Computes tick count

Returns:
tick count
Throws:
ChartException

getUnitSize

public final double getUnitSize()
Returns the absolute value of the scale unit.

Returns:

getMinimum

public final java.lang.Object getMinimum()
Returns:

setMinimum

public final void setMinimum(java.lang.Object o)
Parameters:
o -

getMaximum

public final java.lang.Object getMaximum()
Returns:

setMaximum

public final void setMaximum(java.lang.Object o)
Parameters:
o -

getStep

public final java.lang.Object getStep()
Returns:
step size

setStep

public final void setStep(java.lang.Object o)
Parameters:
o -

getStepNumber

public final java.lang.Integer getStepNumber()
Returns:
step number

setStepNumber

public final void setStepNumber(java.lang.Integer o)

updateAxisMinMax

public final void updateAxisMinMax(java.lang.Object oMinValue,
                                   java.lang.Object oMaxValue)
Computes min, max value, step size and step number of the Axis

Parameters:
oMinValue - min value in data points. Double or CDateTime type.
oMaxValue - max value in data points. Double or CDateTime type.

checkFit

public final boolean checkFit(IDisplayServer xs,
                              Label la,
                              int iLabelLocation)
                       throws ChartException
Checks all labels for any overlap for a given axis' scale

Parameters:
la -
iLabelLocation -
Returns:
Throws:
ChartException

getStart

public final double getStart()
Returns:

getEnd

public final double getEnd()
Returns:

computeTicks

public final int computeTicks(IDisplayServer xs,
                              Label la,
                              int iLabelLocation,
                              int iOrientation,
                              double dStart,
                              double dEnd,
                              boolean bConsiderStartEndLabels,
                              AllAxes aax)
                       throws ChartException
Parameters:
la -
iLabelLocation -
iOrientation -
dStart -
dEnd -
bConsiderStartEndLabels -
aax -
Throws:
ChartException

computeTicks

public final int computeTicks(IDisplayServer xs,
                              Label la,
                              int iLabelLocation,
                              int iOrientation,
                              double dStart,
                              double dEnd,
                              boolean bConsiderStartLabel,
                              boolean bConsiderEndLabel,
                              AllAxes aax)
                       throws ChartException
Parameters:
la -
iLabelLocation -
iOrientation -
dStart -
dEnd -
bConsiderStartEndLabels -
aax -
Throws:
ChartException

formatCategoryValue

public final java.lang.String formatCategoryValue(int iType,
                                                  java.lang.Object oValue,
                                                  int iDateTimeUnit)
Returns the formatted value for given Axis type and value.

Parameters:
iType -
oValue -
Returns:

computeAxisLabelThickness

public final double computeAxisLabelThickness(IDisplayServer xs,
                                              Label la,
                                              int iOrientation)
                                       throws ChartException
Throws:
ChartException

computeStaggeredAxisLabelOffset

public final double computeStaggeredAxisLabelOffset(IDisplayServer xs,
                                                    Label la,
                                                    int iOrientation)
                                             throws ChartException
Parameters:
xs -
la -
iOrientation -
Returns:
Throws:
ChartException

isStepFixed

public final boolean isStepFixed()
Returns:

setStepFixed

public final void setStepFixed(boolean v)
Parameters:
v -

isMinimumFixed

public final boolean isMinimumFixed()
Returns:

setMinimumFixed

public final void setMinimumFixed(boolean v)
Parameters:
v -

isMaximumFixed

public final boolean isMaximumFixed()
Returns:

setMaximumFixed

public final void setMaximumFixed(boolean v)
Parameters:
v -

isCategoryScale

public final boolean isCategoryScale()
Checks if axis is category style or Text type

Returns:

getMinorCoordinates

public final double[] getMinorCoordinates(int iMinorUnitsPerMajor)
Parameters:
iMinorUnitsPerMajor -
Returns:

getRunTimeContext

public final RunTimeContext getRunTimeContext()
Returns:

setRunTimeContext

public final void setRunTimeContext(RunTimeContext context)
Parameters:
context -

setNumberMinMaxToScale

public static void setNumberMinMaxToScale(AutoScale sc,
                                          java.lang.Object oMinimum,
                                          java.lang.Object oMaximum,
                                          RunTimeContext rtc,
                                          OneAxis ax)
                                   throws ChartException
Updates AutoScale by checking min or max

Parameters:
sc -
oMinimum -
oMaximum -
rtc -
ax -
Throws:
ChartException

setStepToScale

public static void setStepToScale(AutoScale sc,
                                  java.lang.Object oStep,
                                  java.lang.Integer oStepNumber,
                                  RunTimeContext rtc)
                           throws ChartException
Updates AutoScale by checking step size and step number

Parameters:
sc -
oStep -
oStepNumber -
rtc -
Throws:
ChartException

computeDecimalFormat

public final com.ibm.icu.text.DecimalFormat computeDecimalFormat(double dAxisValue,
                                                                 double dAxisStep)
Computes the default DecimalFormat pattern for axis according to axis value and scale steps.

Parameters:
dAxisValue - axis value
dAxisStep - scale step
Returns:
default format pattern


Copyright © 2005-2008 Actuate Corp. All rights reserved.