Class 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 Detail

      • KEY_SHARED_MINMAX

        public static java.lang.String KEY_SHARED_MINMAX
    • Method Detail

      • getDirection

        public int getDirection()
        Returns the scale direction.
        Returns:
        direction
      • clone

        public java.lang.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 java.lang.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 -
      • getUnit

        public java.lang.Object getUnit()
      • isTickLabelVisible

        public boolean isTickLabelVisible​(int index)
      • getComputedLabelText

        public java.lang.String getComputedLabelText​(int index)
      • getVisibleLabelIds

        public java.util.Collection<java.lang.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()
      • 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()
      • getUnitSize

        public double getUnitSize()
        Returns the absolute value of the scale unit.
        Returns:
        unit size
      • getMinimum

        public java.lang.Object getMinimum()
      • setMinimum

        public void setMinimum​(java.lang.Object o)
        Parameters:
        o -
      • getMaximum

        public java.lang.Object getMaximum()
      • setMaximum

        public void setMaximum​(java.lang.Object o)
        Parameters:
        o -
      • getStep

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

        public void setStep​(java.lang.Object o)
        Parameters:
        o -
      • getStepNumber

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

        public void setStepNumber​(java.lang.Integer o)
      • getFactor

        public double getFactor()
      • isSetFactor

        public boolean isSetFactor()
      • updateAxisMinMax

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

        public 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:
        formatted string
      • 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)
      • 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
      • computeDefaultDecimalFormat

        public com.ibm.icu.text.DecimalFormat computeDefaultDecimalFormat​(java.lang.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