DecimalFormat df;
    final boolean checkFit(IDisplayServer xs, Label la, int iLabelLocation) throws GenerationException    {        if (iType == TEXT || bCategoryScale)        {            return true;        }        final double dAngleInDegrees = la.getCaption().getFont().getRotation();        double x = 0, y = 0;        int iPointToCheck = 0;        if (iLabelLocation == ABOVE || iLabelLocation == BELOW)        {            iPointToCheck = (dAngleInDegrees < 0 && dAngleInDegrees > -90) ? 3 : 0;        }        else if (iLabelLocation == LEFT || iLabelLocation == RIGHT)        {            iPointToCheck = (dAngleInDegrees < 0 && dAngleInDegrees > -90) ? 2 : 3;        }        double[] da = daTickCoordinates;        RotatedRectangle rrPrev = null, rr;        if ((iType & (NUMERICAL | LINEAR)) == (NUMERICAL | LINEAR))        {            double dAxisValue = asDouble(getMinimum()).doubleValue();            final double dAxisStep = asDouble(getStep()).doubleValue();            String sText;            DecimalFormat df = null;            if (fs == null) // CREATE IF FORMAT SPECIFIER IS UNDEFINED            {                df = new DecimalFormat(getNumericPattern());            }            final NumberDataElement nde = NumberDataElementImpl.create(0);            for (int i = 0; i < da.length; i++)            {                nde.setValue(dAxisValue);                try                {                    sText = ValueFormatter.format(nde, fs, lcl, df);                }                catch (DataFormatException dfex )                {                    DefaultLoggerImpl.instance().log(dfex);                    sText = NULL_STRING;                }                if (iLabelLocation == ABOVE || iLabelLocation == BELOW)                {                    x = da[i];                }                else if (iLabelLocation == LEFT || iLabelLocation == RIGHT)                {                    y = da[i];                }                la.getCaption().setValue(sText);                try                {                    rr = computePolygon(xs, iLabelLocation, la, x, y);                }                catch (UnexpectedInputException uiex )                {                    throw new GenerationException(uiex);                }                Point p = rr.getPoint(iPointToCheck);                if (rrPrev != null && (rrPrev.contains(p) || rrPrev.getPoint(iPointToCheck).equals(p)))                {                    return false;                }                rrPrev = rr;                dAxisValue += dAxisStep;            }        }        else if ((iType & (NUMERICAL | LOGARITHMIC)) == (NUMERICAL | LOGARITHMIC))        {            double dAxisValue = asDouble(getMinimum()).doubleValue();            final double dAxisStep = asDouble(getStep()).doubleValue();            String sText;            DecimalFormat df;            NumberDataElement nde = NumberDataElementImpl.create(0);            for (int i = 0; i < da.length; i++)            {                nde.setValue(dAxisValue);                try                {                    sText = ValueFormatter.format(nde, fs, lcl, this);                }                catch (DataFormatException dfex )                {                    DefaultLoggerImpl.instance().log(dfex);                    sText = NULL_STRING;                }                if (iLabelLocation == ABOVE || iLabelLocation == BELOW)                {                    x = da[i];                }                else if (iLabelLocation == LEFT || iLabelLocation == RIGHT)                {                    y = da[i];                }                la.getCaption().setValue(sText);                try                {                    rr = computePolygon(xs, iLabelLocation, la, x, y);                }                catch (UnexpectedInputException uiex )                {                    throw new GenerationException(uiex);                }                Point p = rr.getPoint(iPointToCheck);                if (rrPrev != null && (rrPrev.contains(p) || rrPrev.getPoint(iPointToCheck).equals(p)))                {                    return false;                }                rrPrev = rr;                dAxisValue *= dAxisStep;            }        }        else if (iType == DATE_TIME)        {            CDateTime cdt, cdtAxisValue = asDateTime(oMinimum);            final int iUnit = asInteger(oUnit);            final int iStep = asInteger(oStep);            final SimpleDateFormat sdf = new SimpleDateFormat(CDateTime.getPreferredFormat(iUnit));            String sText;            cdt = cdtAxisValue;            for (int i = 0; i < da.length; i++)            {                sText = sdf.format(cdt.getTime());                if (iLabelLocation == ABOVE || iLabelLocation == BELOW)                    x = da[i];                else if (iLabelLocation == LEFT || iLabelLocation == RIGHT)                    y = da[i];                la.getCaption().setValue(sText);                try                {                    rr = computePolygon(xs, iLabelLocation, la, x, y);                }                catch (UnexpectedInputException uiex )                {                    throw new GenerationException(uiex);                }                Point p = rr.getPoint(iPointToCheck);                if (rrPrev != null && (rrPrev.contains(p) || rrPrev.getPoint(iPointToCheck).equals(p)))                {                    return false;                }                rrPrev = rr;                cdt = cdtAxisValue.forward(iUnit, iStep * (i + 1)); // ALWAYS                // W.R.T                // START                // VALUE            }        }        return true;    }