Package org.eclipse.birt.chart.computation.withaxes

# Class AutoScale

java.lang.Object
org.eclipse.birt.chart.computation.Methods
org.eclipse.birt.chart.computation.withaxes.AutoScale

All Implemented Interfaces:
  `Cloneable`, `IConstants`

public final class AutoScale extends Methods implements Cloneable
Encapsulates the auto scaling algorithms used by the rendering and chart computation framework.

## Nested Class Summary

Nested Classes
Modifier and Type
Class
Description
`static class`
`AutoScale.ScaleInfo`

## Field Summary

Fields
Modifier and Type
Field
Description
`static String`
`KEY_SHARED_MINMAX`

### Fields inherited from interface org.eclipse.birt.chart.computation.IConstants

`ABOVE, ANCILLARY_AXIS, ANCILLARY_BASE, ARRAY, AUTO, AVERAGE, AXIS, BACKWARD, BASE, BASE_AXIS, BELOW, BIG_NUMBER_PRIMITIVE_ARRAY, BOOLEAN, BOTTOM, CENTER, COLLECTION, DATE_TIME, DESIGN_TIME, EMPTY_STRING, EQUAL, FORWARD, HORIZONTAL, INSIDE, LABELS, LEFT, LEGEND_ENTRY, LEGEND_GROUP_NAME, 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, NUMBER_PRIMITIVE_ARRAY, 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

Constructors
Constructor
Description
`AutoScale(AutoScale.ScaleInfo info)`
`AutoScale(AutoScale.ScaleInfo info, ScaleContext context)`

## Method Summary

Modifier and Type
Method
Description
`boolean`
`checkFit(IDisplayServer xs, Label la, int iLabelLocation)`
Checks all labels for any overlap for a given axis' scale
`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.
`com.ibm.icu.text.DecimalFormat`
`computeDecimalFormat(com.ibm.icu.math.BigDecimal bdAxisValue, com.ibm.icu.math.BigDecimal bdAxisStep)`
`com.ibm.icu.text.DecimalFormat`
`computeDefaultDecimalFormat(Number number)`
Creates a default decimal format based on specified number.
`double`
`computeStaggeredAxisLabelOffset(IDisplayServer xs, Label la, int iOrientation)`
`int`
`computeTicks(IDisplayServer xs, Label la, int iLabelLocation, int iOrientation, double dStart, double dEnd, boolean bConsiderStartLabel, boolean bConsiderEndLabel, AllAxes aax)`
`int`
`computeTicks(IDisplayServer xs, Label la, int iLabelLocation, int iOrientation, double dStart, double dEnd, boolean bConsiderStartEndLabels, AllAxes aax)`
`String`
`formatCategoryValue(int iType, Object oValue, int iDateTimeUnit)`
Returns the formatted value for given Axis type and value.
`com.ibm.icu.math.BigDecimal`
`getBigNumberDivisor()`
Returns big number divisor of axis scale.
`String`
`getComputedLabelText(int index)`
`DataSetIterator`
`getData()`
`int`
`getDirection()`
Returns the scale direction.
`double`
`getEnd()`
`double[]`
`getEndPoints()`
`double`
`getFactor()`
`FormatSpecifier`
`getFormatSpecifier()`
`Object`
`getMaximum()`
`Object`
`getMinimum()`
`double[]`
`getMinorCoordinates(int iMinorUnitsPerMajor)`
`static int`
`getMinUnit(CDateTime cdt)`
`double`
`getNormalizedEnd()`
Returns the normalized end point.
`double[]`
`getNormalizedEndPoints()`
Returns the normalized start and end point.
`double`
`getNormalizedStart()`
Returns the normalized start point.
`String`
`getNumericPattern()`
Returns an auto computed decimal format pattern for representing axis labels on a numeric axis
`RunTimeContext`
`getRunTimeContext()`
`double`
`getStart()`
`Object`
`getStep()`
`Integer`
`getStepNumber()`
`AxisTickCoordinates`
`getTickCordinates()`
`int`
`getTickCount()`
Computes tick count
`int`
`getType()`
`Object`
`getUnit()`
`static int`
`getUnitId(int iUnit)`
`double`
`getUnitSize()`
Returns the absolute value of the scale unit.
`Collection<Integer>`
`getVisibleLabelIds()`
Returns a list of all visible indexes, in the moment works only for category.
`boolean`
`isAxisLabelStaggered()`
`boolean`
`isBigNumber()`
Checks if the axis scale represents big number.
`boolean`
`isCategoryScale()`
Checks if axis is category style or Text type
`boolean`
`isMaximumFixed()`
`boolean`
`isMinimumFixed()`
`boolean`
`isSetFactor()`
`boolean`
`isStepFixed()`
`boolean`
`isTickBetweenCategories()`
`boolean`
`isTickLabelStaggered(int index)`
`boolean`
`isTickLabelVisible(int index)`
`void`
`setBigNubmerDivisor(com.ibm.icu.math.BigDecimal divisor)`
Sets big number divisor for axis scale.
`void`
`setData(DataSetIterator _oaData)`
`void`
`setMaximum(Object o)`
`void`
`setMaximumFixed(boolean v)`
`void`
`setMinimum(Object o)`
`void`
`setMinimumFixed(boolean v)`
`static void`
`setNumberMinMaxToScale(AutoScale sc, Object oMinimum, Object oMaximum, RunTimeContext rtc, OneAxis ax)`
Updates AutoScale by checking min or max
`void`
`setStep(Object o)`
`void`
`setStepFixed(boolean v)`
`void`
`setStepNumber(Integer o)`
`static void`
`setStepToScale(AutoScale sc, Object oStep, Integer oStepNumber, RunTimeContext rtc)`
Updates AutoScale by checking step size and step number
`void`
`updateAxisMinMax(Object oMinValue, 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, computeBox, computeBox, computeFontHeight, computeHeight, computeHeight, computeLabelSize, computePolygon, computePolygon, computePolygon, computeRotatedTopPoint, computeWidth, computeWidth, getLabelPosition, getLocation, getLocation, getLocation, getNormalizedLocation, getNormalizedLocation`

### Methods inherited from class java.lang.Object

`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### KEY_SHARED_MINMAX

public static String KEY_SHARED_MINMAX

## Constructor Details

### AutoScale

public AutoScale(AutoScale.ScaleInfo info)

### AutoScale

public AutoScale(AutoScale.ScaleInfo info, ScaleContext context)

## Method Details

### getDirection

public int getDirection()
Returns the scale direction.

Returns:
  direction

### clone

public Object clone()

### zoomIn

public 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 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 String getNumericPattern()
Returns an auto computed decimal format pattern for representing axis labels on a numeric axis

Returns:
  pattern

### getType

public int getType()

### setData

public void setData(DataSetIterator _oaData)

Parameters:
  `_oaData` -

### getFormatSpecifier

public FormatSpecifier getFormatSpecifier()

### getUnit

public Object getUnit()

### getData

public DataSetIterator getData()

### isTickLabelVisible

public boolean isTickLabelVisible(int index)

### getComputedLabelText

public String getComputedLabelText(int index)

### getVisibleLabelIds

public Collection<Integer> getVisibleLabelIds()
Returns a list of all visible indexes, in the moment works only for category.

Returns:
  id

### isTickLabelStaggered

public boolean isTickLabelStaggered(int index)

### isAxisLabelStaggered

public boolean isAxisLabelStaggered()

### isTickBetweenCategories

public boolean isTickBetweenCategories()

### getTickCordinates

public AxisTickCoordinates getTickCordinates()

### getNormalizedStart

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

Returns:
  start point

### getNormalizedEnd

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

Returns:
  end point

### getNormalizedEndPoints

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

Returns:
  start and end point

### getEndPoints

public double[] getEndPoints()

### getTickCount

public int getTickCount() throws ChartException
Computes tick count

Returns:
  tick count
Throws:
  `ChartException`

### getUnitSize

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

Returns:
  unit size

### getMinimum

public Object getMinimum()

### setMinimum

public void setMinimum(Object o)

Parameters:
  `o` -

### getMaximum

public Object getMaximum()

### setMaximum

public void setMaximum(Object o)

Parameters:
  `o` -

### getStep

public Object getStep()

Returns:
  step size

### setStep

public void setStep(Object o)

Parameters:
  `o` -

### getStepNumber

public Integer getStepNumber()

Returns:
  step number

### setStepNumber

public void setStepNumber(Integer o)

### getFactor

public double getFactor()

### isSetFactor

public boolean isSetFactor()

### updateAxisMinMax

public void updateAxisMinMax(Object oMinValue, 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 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:
  fit or not
Throws:
  `ChartException`

### getStart

public double getStart()

### getEnd

public double getEnd()

### getMinUnit

public static int getMinUnit(CDateTime cdt)

### getUnitId

public static int getUnitId(int iUnit)

### computeTicks

public 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 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` -
  `aax` -
  `bConsiderStartEndLabels` -
Throws:
  `ChartException`

### formatCategoryValue

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

Parameters:
  `iType` -
  `oValue` -
Returns:
  formatted string

### computeAxisLabelThickness

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

Throws:
  `ChartException`

### computeStaggeredAxisLabelOffset

public double computeStaggeredAxisLabelOffset(IDisplayServer xs, Label la, int iOrientation) throws ChartException

Throws:
  `ChartException`

### isStepFixed

public boolean isStepFixed()

### setStepFixed

public void setStepFixed(boolean v)

Parameters:
  `v` -

### isMinimumFixed

public boolean isMinimumFixed()

### setMinimumFixed

public void setMinimumFixed(boolean v)

Parameters:
  `v` -

### isMaximumFixed

public boolean isMaximumFixed()

### setMaximumFixed

public void setMaximumFixed(boolean v)

Parameters:
  `v` -

### isCategoryScale

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

Returns:
  category scale or not

### getMinorCoordinates

public double[] getMinorCoordinates(int iMinorUnitsPerMajor)

### getRunTimeContext

public RunTimeContext getRunTimeContext()

### setNumberMinMaxToScale

public static void setNumberMinMaxToScale(AutoScale sc, Object oMinimum, 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, Object oStep, Integer oStepNumber, RunTimeContext rtc) throws ChartException
Updates AutoScale by checking step size and step number

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

### computeDefaultDecimalFormat

public com.ibm.icu.text.DecimalFormat computeDefaultDecimalFormat(Number number)
Creates a default decimal format based on specified number.

Parameters:
  `number` - specified number.
Returns:
  instance of `DecimalFormat`

### computeDecimalFormat

public com.ibm.icu.text.DecimalFormat computeDecimalFormat(com.ibm.icu.math.BigDecimal bdAxisValue, com.ibm.icu.math.BigDecimal bdAxisStep)

### computeDecimalFormat

public 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

### setBigNubmerDivisor

public void setBigNubmerDivisor(com.ibm.icu.math.BigDecimal divisor)
Sets big number divisor for axis scale.

Parameters:
  `divisor` -
Since:
  2.6

### isBigNumber

public boolean isBigNumber()
Checks if the axis scale represents big number.

Returns:
  boolean
Since:
  2.6

### getBigNumberDivisor

public com.ibm.icu.math.BigDecimal getBigNumberDivisor()
Returns big number divisor of axis scale.

Returns:
  big number divisor
Since:
  2.6