亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? dateaxis.java

?? Web圖形化的Java庫
?? JAVA
?? 第 1 頁 / 共 4 頁
字號:
        tickLabelWidth = estimateMaximumTickLabelWidth(g2, unit2);
        if (tickLabelWidth > unit2Width) {
            unit2 = (DateTickUnit) tickUnits.getLargerTickUnit(unit2);
        }

        setTickUnit(unit2, false, false);

    }

    /**
     * Selects an appropriate tick value for the axis.  The strategy is to
     * display as many ticks as possible (selected from an array of 'standard'
     * tick units) without the labels overlapping.
     *
     * @param g2  the graphics device.
     * @param drawArea  the area in which the plot and axes should be drawn.
     * @param plotArea  the area in which the plot should be drawn.
     * @param edge  the axis location.
     */
    protected void selectVerticalAutoTickUnit(Graphics2D g2, Rectangle2D drawArea,
                                              Rectangle2D plotArea, RectangleEdge edge) {

        // calculate the tick label height...
        FontRenderContext frc = g2.getFontRenderContext();
        double tickLabelHeight = getTickLabelFont().getLineMetrics("123",
            frc).getHeight() + getTickLabelInsets().top + getTickLabelInsets().bottom;

        // now find the smallest tick unit that will accommodate the labels...
        double zero = translateValueToJava2D(0.0, plotArea, edge);

        // start with the current tick unit...
        TickUnits tickUnits = getStandardTickUnits();
        DateTickUnit candidate1 = (DateTickUnit) tickUnits.getCeilingTickUnit(getTickUnit());
        double y = translateValueToJava2D(candidate1.getSize(), plotArea, edge);
        double unitHeight = Math.abs(y - zero);

        // then extrapolate...
        int bestguess = (int) ((tickLabelHeight / unitHeight) * candidate1.getSize());
        TickUnit guess = new NumberTickUnit(bestguess, null);
        DateTickUnit candidate2 = (DateTickUnit) tickUnits.getCeilingTickUnit(guess);

        setTickUnit(candidate2, false, false);
    }

    /**
     * Estimates the maximum width of the tick labels, assuming the specified tick unit is used.
     * <P>
     * Rather than computing the string bounds of every tick on the axis, we just look at two
     * values: the lower bound and the upper bound for the axis.  These two values will usually
     * be representative.
     *
     * @param g2  the graphics device.
     * @param tickUnit  the tick unit to use for calculation.
     *
     * @return the estimated maximum width of the tick labels.
     */
    private double estimateMaximumTickLabelWidth(Graphics2D g2, DateTickUnit tickUnit) {

        Insets tickLabelInsets = getTickLabelInsets();
        double result = tickLabelInsets.left + tickLabelInsets.right;

        FontRenderContext frc = g2.getFontRenderContext();
        Font tickLabelFont = getTickLabelFont();
        if (isVerticalTickLabels()) {
            // all tick labels have the same width (equal to the height of the font)...
            result += tickLabelFont.getStringBounds("1-Jan-2002", frc).getHeight();
        }
        else {
            // look at lower and upper bounds...
            DateRange range = (DateRange) getRange();
            Date lower = range.getLowerDate();
            Date upper = range.getUpperDate();
            String lowerStr = null;
            String upperStr = null;
            DateFormat formatter = getDateFormatOverride();
            if (formatter != null) {
                lowerStr = formatter.format(lower);
                upperStr = formatter.format(upper);
            }
            else {
                lowerStr = tickUnit.dateToString(lower);
                upperStr = tickUnit.dateToString(upper);
            }
            double w1 = tickLabelFont.getStringBounds(lowerStr, frc).getWidth();
            double w2 = tickLabelFont.getStringBounds(upperStr, frc).getWidth();
            result += Math.max(w1, w2);
        }

        return result;

    }

    /**
     * Calculates the positions of the tick labels for the axis, storing the results in the
     * tick label list (ready for drawing).
     *
     * @param g2  the graphics device.
     * @param cursor  the cursor location.
     * @param plotArea  the area in which the plot and the axes should be drawn.
     * @param dataArea  the area in which the plot should be drawn.
     * @param edge  the location of the axis.
     *
     */
    public void refreshTicks(Graphics2D g2, double cursor,
                             Rectangle2D plotArea, Rectangle2D dataArea,
                             RectangleEdge edge) {

        if (RectangleEdge.isTopOrBottom(edge)) {
            refreshTicksHorizontal(g2, cursor, plotArea, dataArea, edge);
        }
        else if (RectangleEdge.isLeftOrRight(edge)) {
            refreshTicksVertical(g2, cursor, plotArea, dataArea, edge);
        }

    }

    /**
     * Recalculates the ticks for the date axis.
     *
     * @param g2  the graphics device.
     * @param cursor  the cursor location.
     * @param plotArea  the area in which the axes and data are to be drawn.
     * @param dataArea  the area in which the data is to be drawn.
     * @param edge  the location of the axis.
     *
     */
    public void refreshTicksHorizontal(Graphics2D g2, double cursor,
                                       Rectangle2D plotArea, Rectangle2D dataArea,
                                       RectangleEdge edge) {

        getTicks().clear();

        Font tickLabelFont = getTickLabelFont();
        g2.setFont(tickLabelFont);

        if (isAutoTickUnitSelection()) {
            selectAutoTickUnit(g2, plotArea, dataArea, edge);
        }

        DateTickUnit unit = getTickUnit();
        Date tickDate = calculateLowestVisibleTickValue(unit);
        Date upperDate = getMaximumDate();
        float lastX = Float.MIN_VALUE;
        while (tickDate.before(upperDate)) {

            if (!isHiddenValue(tickDate.getTime())) {
                // work out the value, label and position
                double xx = translateDateToJava2D(tickDate, dataArea, edge);
                String tickLabel;
                DateFormat formatter = getDateFormatOverride();
                if (formatter != null) {
                    tickLabel = formatter.format(tickDate);
                }
                else {
                    tickLabel = tickUnit.dateToString(tickDate);
                }
                FontRenderContext frc = g2.getFontRenderContext();
                Rectangle2D tickLabelBounds = tickLabelFont.getStringBounds(tickLabel, frc);
                LineMetrics metrics = tickLabelFont.getLineMetrics(tickLabel, frc);
                float x = 0.0f;
                float y = 0.0f;
                Insets tickLabelInsets = getTickLabelInsets();
                if (isVerticalTickLabels()) {
                    x = (float) (xx + tickLabelBounds.getHeight() / 2 - metrics.getDescent());
                    if (edge == RectangleEdge.TOP) {
                        y = (float) (cursor - tickLabelInsets.bottom - tickLabelBounds.getWidth());
                    }
                    else {
                        y = (float) (cursor + tickLabelInsets.top + tickLabelBounds.getWidth());
                    }
                }
                else {
                    x = (float) (xx - tickLabelBounds.getWidth() / 2);
                    if (edge == RectangleEdge.TOP) {
                        y = (float) (cursor - tickLabelInsets.bottom 
                                            - metrics.getDescent() - metrics.getLeading());
                    }
                    else {
                        y = (float) (cursor + tickLabelInsets.top + tickLabelBounds.getHeight());
                    }
                }

                // Prevent overwriting a label on top of a previous one. This can occure if we're
                // using a SegmentedTimeline as more than one Date can map to the same timeline value.
                if (x > lastX) {
                    Tick tick = new Tick(tickDate, tickLabel, x, y);
                    getTicks().add(tick);
                    if (isVerticalTickLabels()) {
                        lastX = x + (float) tickLabelBounds.getHeight();
                    } 
                    else {
                        lastX = x + (float) tickLabelBounds.getWidth();
                    }
                }
            }
                tickDate = unit.addToDate(tickDate);
            
                // could add a flag to make the following correction optional...
                RegularTimePeriod period = null;
                switch (unit.getUnit()) {

                    case (DateTickUnit.MILLISECOND) :
                    case (DateTickUnit.SECOND) :
                    case (DateTickUnit.MINUTE) :
                    case (DateTickUnit.HOUR) :
                    case (DateTickUnit.DAY) :
                        break;

                    case (DateTickUnit.MONTH) :
                        tickDate = calculateDateForPosition(new Month(tickDate), this.tickMarkPosition);
                        break;
                    case(DateTickUnit.YEAR) :
                        tickDate = calculateDateForPosition(new Year(tickDate), this.tickMarkPosition);
                        break;

                    default: break;

                }
            
        }

    }

    /**
     * Recalculates the ticks for the date axis.
     *
     * @param g2  the graphics device.
     * @param cursor  the cursor location.
     * @param plotArea  the area in which the plot and the axes should be drawn.
     * @param dataArea  the area in which the plot should be drawn.
     * @param edge  the location of the axis.
     *
     */
    public void refreshTicksVertical(Graphics2D g2, double cursor,
                             Rectangle2D plotArea, Rectangle2D dataArea,
                             RectangleEdge edge) {

        getTicks().clear();

        Font tickLabelFont = getTickLabelFont();
        g2.setFont(tickLabelFont);

        FontRenderContext frc = g2.getFontRenderContext();
        if (isAutoTickUnitSelection()) {
            selectAutoTickUnit(g2, plotArea, dataArea, edge);
        }
        Rectangle2D labelBounds = null;
        DateTickUnit unit = getTickUnit();
        Date tickDate = calculateLowestVisibleTickValue(unit);
        Date upperDate = calculateHighestVisibleTickValue(unit);
        while (tickDate.before(upperDate)) {

            if (!isHiddenValue(tickDate.getTime())) {
                // work out the value, label and position
                double yy = translateDateToJava2D(tickDate, dataArea, edge);
                String tickLabel = tickUnit.dateToString(tickDate);
                labelBounds = tickLabelFont.getStringBounds(tickLabel, g2.getFontRenderContext());
                LineMetrics metrics = tickLabelFont.getLineMetrics(tickLabel, frc);
                float x;
                if (edge == RectangleEdge.LEFT) {
                    x = (float) (cursor - labelBounds.getWidth() - getTickLabelInsets().right);
                }
                else {
                    x = (float) (cursor + getTickLabelInsets().left);
                }
                float y = (float) (yy + (metrics.getAscent() / 2));
                Tick tick = new Tick(tickDate, tickLabel, x, y);
                getTicks().add(tick);
                tickDate = unit.addToDate(tickDate);
            }
        }
    }

    /**
     * Draws the axis on a Java 2D graphics device (such as the screen or a printer).
     *
     * @param g2  the graphics device.
     * @param cursor  the cursor location.
     * @param plotArea  the area within which the axes and data should be drawn.
     * @param dataArea  the area within which the data should be drawn.
     * @param edge  the location of the axis.
     * 
     * @return The new cursor location.
     */
    public double draw(Graphics2D g2, double cursor,
                       Rectangle2D plotArea, Rectangle2D dataArea, RectangleEdge edge) {

        // if the axis is not visible, don't draw it...
        if (!isVisible()) {
            // even though the axis is not visible, we need to refresh ticks in case the grid
            // is being drawn...
            refreshTicks(g2, cursor, plotArea, dataArea, edge);
            return 0.0;
        }

        // draw the tick marks and labels...
        double used1 = drawTickMarksAndLabels(g2, cursor, plotArea, dataArea, edge);
        if (edge == RectangleEdge.TOP || edge == RectangleEdge.LEFT) {
            cursor = cursor - used1;
        }
        else if (edge == RectangleEdge.BOTTOM || edge == RectangleEdge.RIGHT) {
            cursor = cursor + used1;
        }

        // draw the axis label...
        double used2 = drawLabel(getLabel(), g2, cursor, plotArea, dataArea, edge);

        return used1 + used2;

    }

    /**
     * Draws the axis line, tick marks and tick mark labels.
     * 
     * @param g2  the graphics device.
     * @param cursor  the cursor.
     * @param plotArea  the plot area.
     * @param dataArea  the data area.
     * @param edge  the edge that the axis is aligned with.
     * 
     * @return The width or height used to draw the axis.
     */
    protected double drawTickMarksAndLabels(Graphics2D g2, double cursor,
                                            Rectangle2D plotArea,
                                            Rectangle2D dataArea, RectangleEdge edge) {
                                              
        if (isAxisLineVisible()) {
            drawAxisLine(g2, cursor, dataArea, edge);
        }

        double ol = getTickMarkOutsideLength();
        double il = getTickMarkInsideLength();

        refreshTicks(g2, cursor, plotArea, dataArea, edge);
        g2.setFont(getTickLabelFont());
        Iterator iterator = getTicks().iterator();
        while (iterator.hasNext()) {
            Tick tick = (Tick) iterator.next();
            float xx = (float) translateValueToJava2D(tick.getNumericalValue(), dataArea, edge);
            if (isTickLabelsVisible()) {
                g2.setPaint(getTickLabelPaint());
                if (isVerticalTickLabels()) {
                    RefineryUtilities.drawRotatedString(tick.getText(), g2,
                                                        tick.getX(), tick.getY(), -Math.PI / 2);
                }
                else {
                    g2.drawString(tick.getText(), tick.getX(), tick.getY());
                }
            }

            if (isTickMarksVisible()) {
                Line2D mark = null;
                g2.setStroke(getTickMarkStroke());
                g2.setPaint(getTickMarkPaint());
                if (edge == RectangleEdge.LEFT) {
                    mark = new Line2D.Double(cursor - ol, xx, cursor + il, xx);
                }
                else if (edge == RectangleEdge.RIGHT) {
                    mark = new Line2D.Double(cursor + ol, xx, cursor - il, xx);
                }
                else if (edge == RectangleEdge.TOP) {
                    mark = new Line2D.Double(xx, cursor - ol, xx, cursor + il);
                }
                else if (edge == RectangleEdge.BOTTOM) {
                    mark = new Line2D.Double(xx, cursor + ol, xx, cursor - il);
                }
                g2.draw(mark);
            }
        }
        return this.reservedForTickLabels;
    }
    
    /**
     * Returns a clone of the object.
     * 
     * @return A clone.
     * 
     * @throws CloneNotSupportedException if some component of the axis does not support cloning.
     */
    public Object clone() throws CloneNotSupportedException {
        
        DateAxis clone = (DateAxis) super.clone();
        
        // 'dateTickUnit' is immutable : no need to clone
        if (this.dateFormatOverride != null) {
            clone.dateFormatOverride = (DateFormat) this.dateFormatOverride.clone();
        }
        // 'tickMarkPosition' is immutable : no need to clone
        
        return clone;
        
    }
    
  
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲欧洲av一区二区三区久久| 日韩高清在线不卡| 日日夜夜免费精品| 99re热视频这里只精品| 日韩欧美黄色影院| 一区二区三区四区视频精品免费| 久草精品在线观看| 欧美三区免费完整视频在线观看| 国产精品久久久久久福利一牛影视| 热久久久久久久| 在线亚洲高清视频| 国产精品久久久久影院| 国内精品国产成人| 欧美成人福利视频| 日本午夜一区二区| 欧美绝品在线观看成人午夜影视| 亚洲丝袜美腿综合| 不卡欧美aaaaa| 久久久www免费人成精品| 日本vs亚洲vs韩国一区三区二区| 在线观看一区二区精品视频| 国产精品美女久久久久久久久 | 国模套图日韩精品一区二区| 欧美日韩在线三区| 一区二区三区四区精品在线视频| 99久久精品免费观看| 国产视频不卡一区| 国产成人免费视频一区| 国产视频一区二区在线观看| 久久99九九99精品| 久久一区二区三区四区| 激情成人午夜视频| 久久久美女毛片| 国产麻豆精品久久一二三| 日韩久久久久久| 九色综合国产一区二区三区| 欧美va亚洲va在线观看蝴蝶网| 免播放器亚洲一区| 欧美不卡一区二区三区四区| 麻豆国产欧美一区二区三区| 精品国产乱码久久| 国产制服丝袜一区| 欧美国产精品专区| 色综合视频一区二区三区高清| 亚洲视频一区二区在线观看| 在线视频你懂得一区| 一区二区在线免费观看| 欧美日韩在线三级| 日韩黄色一级片| 欧美精品一区视频| 成人黄页毛片网站| 亚洲午夜日本在线观看| 日韩欧美国产高清| 国产精品一卡二卡在线观看| 中文字幕+乱码+中文字幕一区| 91在线云播放| 亚洲一区二区三区国产| 欧美成人一区二区三区片免费| 国产a久久麻豆| 亚洲精品视频在线观看网站| 91精品国产色综合久久ai换脸| 日韩一区精品视频| 久久精品日产第一区二区三区高清版| 成人99免费视频| 亚洲成人高清在线| 久久亚洲二区三区| 99久久亚洲一区二区三区青草 | 欧洲国产伦久久久久久久| 亚洲综合精品自拍| 欧美成人高清电影在线| eeuss鲁片一区二区三区在线看| 午夜精品久久久久| 欧美国产成人精品| 欧美一区二区视频免费观看| 国产成人精品免费视频网站| 亚洲国产wwwccc36天堂| 国产网红主播福利一区二区| 欧美日韩视频在线一区二区| 风间由美性色一区二区三区| 五月天久久比比资源色| 中文字幕va一区二区三区| 91精品啪在线观看国产60岁| 99精品久久免费看蜜臀剧情介绍| 蜜乳av一区二区| 亚洲精品中文字幕在线观看| 久久午夜国产精品| 欧美嫩在线观看| 99久久精品国产麻豆演员表| 极品少妇一区二区三区精品视频| 亚洲精品久久久蜜桃| 国产亚洲一区二区三区四区 | 国产香蕉久久精品综合网| 在线观看日韩高清av| 国产精品一区二区在线观看不卡| 亚洲一区国产视频| 18成人在线观看| 国产欧美日韩另类一区| 日韩精品中文字幕在线一区| 在线看日韩精品电影| 99久久精品免费观看| 国产精品一区二区久久精品爱涩| 卡一卡二国产精品| 丝袜美腿亚洲色图| 亚洲成人免费在线| 亚洲午夜一区二区| 亚洲高清免费观看高清完整版在线观看| 中文字幕不卡三区| 国产精品网站在线| 国产日本一区二区| 国产欧美一二三区| 国产日韩欧美在线一区| 精品99999| 精品成人在线观看| 欧美精品一区二区三区四区 | 欧美日韩一区二区欧美激情| 在线视频综合导航| 精品视频在线免费观看| 欧美专区日韩专区| 在线中文字幕一区二区| 欧洲av在线精品| 欧美日韩高清影院| 这里只有精品视频在线观看| 91麻豆精品91久久久久久清纯| 色婷婷av一区| 欧美日韩一区 二区 三区 久久精品| 欧美亚洲动漫制服丝袜| 欧美日韩中文字幕一区| 7777精品伊人久久久大香线蕉的| 精品污污网站免费看| 欧美精品乱人伦久久久久久| 91精品国产黑色紧身裤美女| 欧美一级淫片007| 精品国产乱码久久久久久闺蜜| 久久久久久久久久久久久女国产乱 | 国产成人啪免费观看软件| 成人午夜电影网站| 99视频精品全部免费在线| 日本福利一区二区| 欧美日韩久久不卡| 欧美电影免费观看完整版| 精品国产1区2区3区| 亚洲国产高清在线观看视频| 亚洲欧美乱综合| 日韩综合小视频| 黄色资源网久久资源365| 成人妖精视频yjsp地址| 色综合久久中文字幕综合网| 欧美三级三级三级| 久久久一区二区三区捆绑**| 一区二区三区在线高清| 琪琪一区二区三区| 顶级嫩模精品视频在线看| 色综合久久久久久久久久久| 3d成人h动漫网站入口| 国产三级精品三级在线专区| 亚洲一级二级在线| 国产精品原创巨作av| 欧美午夜视频网站| 国产色婷婷亚洲99精品小说| 亚洲大片在线观看| 成人精品高清在线| 欧美一级艳片视频免费观看| 国产精品美女久久久久久久| 美女一区二区三区| 91蜜桃视频在线| 日韩精品一区在线| 亚洲综合色区另类av| 国产成人av电影在线| 欧美综合一区二区| 中文字幕 久热精品 视频在线| 日韩中文字幕区一区有砖一区 | 黄色小说综合网站| 欧美怡红院视频| 国产网红主播福利一区二区| 五月激情六月综合| 成人av免费在线播放| 欧美一级一区二区| 亚洲一区二区不卡免费| 粉嫩嫩av羞羞动漫久久久| 欧美一区日韩一区| 亚洲激情在线播放| av亚洲精华国产精华精| 欧美精品一区二区三区视频| 日韩电影在线免费| 欧美在线观看禁18| 亚洲柠檬福利资源导航| 懂色av中文字幕一区二区三区| 精品少妇一区二区三区在线播放| 亚洲第一电影网| 欧美视频中文一区二区三区在线观看 | 亚洲主播在线播放| 91视视频在线观看入口直接观看www | 一区二区三区电影在线播| 国产老妇另类xxxxx| 精品国产乱码久久久久久免费 | 午夜一区二区三区视频| 97精品视频在线观看自产线路二 | 亚洲精品一区二区三区香蕉| 麻豆精品国产传媒mv男同| 69堂国产成人免费视频|