afreechart/src/main/java/org/afree/chart/axis/PeriodAxis.java
/**
     * Draws the major and minor tick marks for an axis that lies at the top or
     * bottom of the plot.
     *
     * @param canvas  the graphics device.
     * @param state  the axis state.
     * @param dataArea  the data area.
     * @param edge  the edge.
     */
Draws the major and minor tick marks for an axis that lies at the top or
bottom of the plot.

@param canvas  the graphics device.
@param state  the axis state.
@param dataArea  the data area.
@param edge  the edge.
Draws the major and minor tick marks for an axis that lies at the top or bottom of the plot . @param canvas the graphics device . @param state the axis state . @param dataArea the data area . @param edge the edge .
protected void drawTickMarksHorizontal(Canvas canvas, AxisState state,
                                           RectShape dataArea,
                                           RectangleEdge edge) {
        List ticks = new ArrayList();
        double x0 = dataArea.getX();
        double y0 = state.getCursor();
        double insideLength = getTickMarkInsideLength();
        double outsideLength = getTickMarkOutsideLength();
        RegularTimePeriod t = createInstance(this.majorTickTimePeriodClass, 
                this.first.getStart(), getTimeZone(), this.locale);
        long t0 = t.getFirstMillisecond();
        LineShape inside = null;
        LineShape outside = null;
        long firstOnAxis = getFirst().getFirstMillisecond();
        long lastOnAxis = getLast().getLastMillisecond() + 1;
        while (t0 <= lastOnAxis) {
            ticks.add(new NumberTick(new Double(t0), "", TextAnchor.CENTER,
                    TextAnchor.CENTER, 0.0));
            x0 = valueToJava2D(t0, dataArea, edge);
            if (edge == RectangleEdge.TOP) {
                inside = new LineShape(x0, y0, x0, y0 + insideLength);
                outside = new LineShape(x0, y0, x0, y0 - outsideLength);
            }
            else if (edge == RectangleEdge.BOTTOM) {
                inside = new LineShape(x0, y0, x0, y0 - insideLength);
                outside = new LineShape(x0, y0, x0, y0 + outsideLength);
            }
            if (t0 >= firstOnAxis) {
                Paint paint = PaintUtility.createPaint(
                        Paint.ANTI_ALIAS_FLAG,
                        getTickMarkPaintType(), 
                        getTickMarkStroke(), 
                        getTickMarkEffect());
                canvas.drawLine((float) inside.getX1(), (float) inside.getY1(),
                        (float) inside.getX2(), (float) inside.getY2(),
                        paint);
                canvas.drawLine((float) outside.getX1(), (float) outside.getY1(),
                        (float) outside.getX2(), (float) outside.getY2(),
                        paint);                
            }
            if (this.minorTickMarksVisible) {
                RegularTimePeriod tminor = createInstance(
                        this.minorTickTimePeriodClass, new Date(t0),
                        getTimeZone(), this.locale);
                long tt0 = tminor.getFirstMillisecond();
                while (tt0 < t.getLastMillisecond()
                        && tt0 < lastOnAxis) {
                    double xx0 = valueToJava2D(tt0, dataArea, edge);
                    if (edge == RectangleEdge.TOP) {
                        inside = new LineShape(xx0, y0, xx0,
                                y0 + this.minorTickMarkInsideLength);
                        outside = new LineShape(xx0, y0, xx0,
                                y0 - this.minorTickMarkOutsideLength);
                    }
                    else if (edge == RectangleEdge.BOTTOM) {
                        inside = new LineShape(xx0, y0, xx0,
                                y0 - this.minorTickMarkInsideLength);
                        outside = new LineShape(xx0, y0, xx0,
                                y0 + this.minorTickMarkOutsideLength);
                    }
                    if (tt0 >= firstOnAxis) {
                        Paint paint = PaintUtility.createPaint(
                                Paint.ANTI_ALIAS_FLAG,
                                getMinorTickMarkPaintType(), 
                                getMinorTickMarkStroke(), 
                                getMinorTickMarkEffect());
                        canvas.drawLine((float) inside.getX1(), (float) inside.getY1(),
                                (float) inside.getX2(), (float) inside.getY2(),
                                paint);
                        canvas.drawLine((float) outside.getX1(), (float) outside.getY1(),
                                (float) outside.getX2(), (float) outside.getY2(),
                                paint);                             
                    }
                    tminor = tminor.next();
                    tminor.peg(this.calendar);
                    tt0 = tminor.getFirstMillisecond();
                }
            }
            t = t.next();
            t.peg(this.calendar);
            t0 = t.getFirstMillisecond();
        }
        if (edge == RectangleEdge.TOP) {
            state.cursorUp(Math.max(outsideLength,
                    this.minorTickMarkOutsideLength));
        }
        else if (edge == RectangleEdge.BOTTOM) {
            state.cursorDown(Math.max(outsideLength,
                    this.minorTickMarkOutsideLength));
        }
        state.setTicks(ticks);
    }
protected void drawTickMarksHorizontal ( Canvas canvas , AxisState state , RectShape dataArea , RectangleEdge edge ) { List ticks = new ArrayList ( ) ; double x0 = dataArea . getX ( ) ; double y0 = state . getCursor ( ) ; double insideLength = getTickMarkInsideLength ( ) ; double outsideLength = getTickMarkOutsideLength ( ) ; RegularTimePeriod t = createInstance ( this . majorTickTimePeriodClass , this . first . getStart ( ) , getTimeZone ( ) , this . locale ) ; long t0 = t . getFirstMillisecond ( ) ; LineShape inside = null ; LineShape outside = null ; long firstOnAxis = getFirst ( ) . getFirstMillisecond ( ) ; long lastOnAxis = getLast ( ) . getLastMillisecond ( ) + 1 ; while ( t0 <= lastOnAxis ) { ticks . add ( new NumberTick ( new Double ( t0 ) , "" , TextAnchor . CENTER , TextAnchor . CENTER , 0.0 ) ) ; x0 = valueToJava2D ( t0 , dataArea , edge ) ; if ( edge == RectangleEdge . TOP ) { inside = new LineShape ( x0 , y0 , x0 , y0 + insideLength ) ; outside = new LineShape ( x0 , y0 , x0 , y0 - outsideLength ) ; } else if ( edge == RectangleEdge . BOTTOM ) { inside = new LineShape ( x0 , y0 , x0 , y0 - insideLength ) ; outside = new LineShape ( x0 , y0 , x0 , y0 + outsideLength ) ; } if ( t0 >= firstOnAxis ) { Paint paint = PaintUtility . createPaint ( Paint . ANTI_ALIAS_FLAG , getTickMarkPaintType ( ) , getTickMarkStroke ( ) , getTickMarkEffect ( ) ) ; canvas . drawLine ( ( float ) inside . getX1 ( ) , ( float ) inside . getY1 ( ) , ( float ) inside . getX2 ( ) , ( float ) inside . getY2 ( ) , paint ) ; canvas . drawLine ( ( float ) outside . getX1 ( ) , ( float ) outside . getY1 ( ) , ( float ) outside . getX2 ( ) , ( float ) outside . getY2 ( ) , paint ) ; } if ( this . minorTickMarksVisible ) { RegularTimePeriod tminor = createInstance ( this . minorTickTimePeriodClass , new Date ( t0 ) , getTimeZone ( ) , this . locale ) ; long tt0 = tminor . getFirstMillisecond ( ) ; while ( tt0 < t . getLastMillisecond ( ) && tt0 < lastOnAxis ) { double xx0 = valueToJava2D ( tt0 , dataArea , edge ) ; if ( edge == RectangleEdge . TOP ) { inside = new LineShape ( xx0 , y0 , xx0 , y0 + this . minorTickMarkInsideLength ) ; outside = new LineShape ( xx0 , y0 , xx0 , y0 - this . minorTickMarkOutsideLength ) ; } else if ( edge == RectangleEdge . BOTTOM ) { inside = new LineShape ( xx0 , y0 , xx0 , y0 - this . minorTickMarkInsideLength ) ; outside = new LineShape ( xx0 , y0 , xx0 , y0 + this . minorTickMarkOutsideLength ) ; } if ( tt0 >= firstOnAxis ) { Paint paint = PaintUtility . createPaint ( Paint . ANTI_ALIAS_FLAG , getMinorTickMarkPaintType ( ) , getMinorTickMarkStroke ( ) , getMinorTickMarkEffect ( ) ) ; canvas . drawLine ( ( float ) inside . getX1 ( ) , ( float ) inside . getY1 ( ) , ( float ) inside . getX2 ( ) , ( float ) inside . getY2 ( ) , paint ) ; canvas . drawLine ( ( float ) outside . getX1 ( ) , ( float ) outside . getY1 ( ) , ( float ) outside . getX2 ( ) , ( float ) outside . getY2 ( ) , paint ) ; } tminor = tminor . next ( ) ; tminor . peg ( this . calendar ) ; tt0 = tminor . getFirstMillisecond ( ) ; } } t = t . next ( ) ; t . peg ( this . calendar ) ; t0 = t . getFirstMillisecond ( ) ; } if ( edge == RectangleEdge . TOP ) { state . cursorUp ( Math . max ( outsideLength , this . minorTickMarkOutsideLength ) ) ; } else if ( edge == RectangleEdge . BOTTOM ) { state . cursorDown ( Math . max ( outsideLength , this . minorTickMarkOutsideLength ) ) ; } state . setTicks ( ticks ) ; }
Draws the major and minor tick marks for an axis that lies at the top or
 bottom of the plot.
Draws the major and minor tick marks for an axis that lies at the top or bottom of the plot .
//                canvas.setPaint(getTickMarkPaint()); //                canvas.setStroke(getTickMarkStroke()); //                canvas.draw(inside); //                canvas.draw(outside); // draw minor tick marks //                        canvas.setPaint(this.minorTickMarkPaint); //                        canvas.setStroke(this.minorTickMarkStroke); //                        canvas.draw(inside); //                        canvas.draw(outside);