Java Code Examples for org.jfree.data.time.RegularTimePeriod#peg()

The following examples show how to use org.jfree.data.time.RegularTimePeriod#peg() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ExtTimeTableXYDataset.java    From pentaho-reporting with GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
 * Adds a new data item to the dataset and, if requested, sends a {@link DatasetChangeEvent} to all registered
 * listeners.
 *
 * @param period     the time period (<code>null</code> not permitted).
 * @param y          the value for this period (<code>null</code> permitted).
 * @param seriesName the name of the series to add the value (<code>null</code> not permitted).
 * @param notify     whether dataset listener are notified or not.
 * @see #remove(TimePeriod, Comparable, boolean)
 */
public void add( final TimePeriod period, final Number y, final Comparable seriesName,
                 final boolean notify ) {
  // here's a quirk - the API has been defined in terms of a plain
  // TimePeriod, which cannot make use of the timezone and locale
  // specified in the constructor...so we only do the time zone
  // pegging if the period is an instanceof RegularTimePeriod
  if ( period instanceof RegularTimePeriod ) {
    final RegularTimePeriod p = (RegularTimePeriod) period;
    p.peg( this.workingCalendar );
  }
  this.values.addValue( y, period, seriesName );
  if ( notify ) {
    fireDatasetChanged();
  }
}
 
Example 2
Source File: PeriodAxis.java    From openstock with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Draws the major and minor tick marks for an axis that lies at the top or
 * bottom of the plot.
 *
 * @param g2  the graphics device.
 * @param state  the axis state.
 * @param dataArea  the data area.
 * @param edge  the edge.
 */
protected void drawTickMarksHorizontal(Graphics2D g2, AxisState state,
        Rectangle2D dataArea, RectangleEdge edge) {
    List ticks = new ArrayList();
    double x0;
    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();
    Line2D inside = null;
    Line2D outside = null;
    long firstOnAxis = getFirst().getFirstMillisecond();
    long lastOnAxis = getLast().getLastMillisecond() + 1;
    while (t0 <= lastOnAxis) {
        ticks.add(new NumberTick(Double.valueOf(t0), "", TextAnchor.CENTER,
                TextAnchor.CENTER, 0.0));
        x0 = valueToJava2D(t0, dataArea, edge);
        if (edge == RectangleEdge.TOP) {
            inside = new Line2D.Double(x0, y0, x0, y0 + insideLength);
            outside = new Line2D.Double(x0, y0, x0, y0 - outsideLength);
        }
        else if (edge == RectangleEdge.BOTTOM) {
            inside = new Line2D.Double(x0, y0, x0, y0 - insideLength);
            outside = new Line2D.Double(x0, y0, x0, y0 + outsideLength);
        }
        if (t0 >= firstOnAxis) {
            g2.setPaint(getTickMarkPaint());
            g2.setStroke(getTickMarkStroke());
            g2.draw(inside);
            g2.draw(outside);
        }
        // draw minor tick marks
        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 Line2D.Double(xx0, y0, xx0,
                            y0 + this.minorTickMarkInsideLength);
                    outside = new Line2D.Double(xx0, y0, xx0,
                            y0 - this.minorTickMarkOutsideLength);
                }
                else if (edge == RectangleEdge.BOTTOM) {
                    inside = new Line2D.Double(xx0, y0, xx0,
                            y0 - this.minorTickMarkInsideLength);
                    outside = new Line2D.Double(xx0, y0, xx0,
                            y0 + this.minorTickMarkOutsideLength);
                }
                if (tt0 >= firstOnAxis) {
                    g2.setPaint(this.minorTickMarkPaint);
                    g2.setStroke(this.minorTickMarkStroke);
                    g2.draw(inside);
                    g2.draw(outside);
                }
                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);
}
 
Example 3
Source File: PeriodAxis.java    From ccu-historian with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Draws the major and minor tick marks for an axis that lies at the top or
 * bottom of the plot.
 *
 * @param g2  the graphics device.
 * @param state  the axis state.
 * @param dataArea  the data area.
 * @param edge  the edge.
 */
protected void drawTickMarksHorizontal(Graphics2D g2, AxisState state,
        Rectangle2D dataArea, RectangleEdge edge) {
    List ticks = new ArrayList();
    double x0;
    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();
    Line2D inside = null;
    Line2D outside = null;
    long firstOnAxis = getFirst().getFirstMillisecond();
    long lastOnAxis = getLast().getLastMillisecond() + 1;
    while (t0 <= lastOnAxis) {
        ticks.add(new NumberTick(Double.valueOf(t0), "", TextAnchor.CENTER,
                TextAnchor.CENTER, 0.0));
        x0 = valueToJava2D(t0, dataArea, edge);
        if (edge == RectangleEdge.TOP) {
            inside = new Line2D.Double(x0, y0, x0, y0 + insideLength);
            outside = new Line2D.Double(x0, y0, x0, y0 - outsideLength);
        }
        else if (edge == RectangleEdge.BOTTOM) {
            inside = new Line2D.Double(x0, y0, x0, y0 - insideLength);
            outside = new Line2D.Double(x0, y0, x0, y0 + outsideLength);
        }
        if (t0 >= firstOnAxis) {
            g2.setPaint(getTickMarkPaint());
            g2.setStroke(getTickMarkStroke());
            g2.draw(inside);
            g2.draw(outside);
        }
        // draw minor tick marks
        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 Line2D.Double(xx0, y0, xx0,
                            y0 + this.minorTickMarkInsideLength);
                    outside = new Line2D.Double(xx0, y0, xx0,
                            y0 - this.minorTickMarkOutsideLength);
                }
                else if (edge == RectangleEdge.BOTTOM) {
                    inside = new Line2D.Double(xx0, y0, xx0,
                            y0 - this.minorTickMarkInsideLength);
                    outside = new Line2D.Double(xx0, y0, xx0,
                            y0 + this.minorTickMarkOutsideLength);
                }
                if (tt0 >= firstOnAxis) {
                    g2.setPaint(this.minorTickMarkPaint);
                    g2.setStroke(this.minorTickMarkStroke);
                    g2.draw(inside);
                    g2.draw(outside);
                }
                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);
}
 
Example 4
Source File: PeriodAxis.java    From SIMVA-SoS with Apache License 2.0 4 votes vote down vote up
/**
 * Draws the major and minor tick marks for an axis that lies at the top or
 * bottom of the plot.
 *
 * @param g2  the graphics device.
 * @param state  the axis state.
 * @param dataArea  the data area.
 * @param edge  the edge.
 */
protected void drawTickMarksHorizontal(Graphics2D g2, AxisState state,
        Rectangle2D dataArea, RectangleEdge edge) {
    List ticks = new ArrayList();
    double x0;
    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();
    Line2D inside = null;
    Line2D outside = null;
    long firstOnAxis = getFirst().getFirstMillisecond();
    long lastOnAxis = getLast().getLastMillisecond() + 1;
    while (t0 <= lastOnAxis) {
        ticks.add(new NumberTick(Double.valueOf(t0), "", TextAnchor.CENTER,
                TextAnchor.CENTER, 0.0));
        x0 = valueToJava2D(t0, dataArea, edge);
        if (edge == RectangleEdge.TOP) {
            inside = new Line2D.Double(x0, y0, x0, y0 + insideLength);
            outside = new Line2D.Double(x0, y0, x0, y0 - outsideLength);
        }
        else if (edge == RectangleEdge.BOTTOM) {
            inside = new Line2D.Double(x0, y0, x0, y0 - insideLength);
            outside = new Line2D.Double(x0, y0, x0, y0 + outsideLength);
        }
        if (t0 >= firstOnAxis) {
            g2.setPaint(getTickMarkPaint());
            g2.setStroke(getTickMarkStroke());
            g2.draw(inside);
            g2.draw(outside);
        }
        // draw minor tick marks
        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 Line2D.Double(xx0, y0, xx0,
                            y0 + this.minorTickMarkInsideLength);
                    outside = new Line2D.Double(xx0, y0, xx0,
                            y0 - this.minorTickMarkOutsideLength);
                }
                else if (edge == RectangleEdge.BOTTOM) {
                    inside = new Line2D.Double(xx0, y0, xx0,
                            y0 - this.minorTickMarkInsideLength);
                    outside = new Line2D.Double(xx0, y0, xx0,
                            y0 + this.minorTickMarkOutsideLength);
                }
                if (tt0 >= firstOnAxis) {
                    g2.setPaint(this.minorTickMarkPaint);
                    g2.setStroke(this.minorTickMarkStroke);
                    g2.draw(inside);
                    g2.draw(outside);
                }
                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);
}
 
Example 5
Source File: PeriodAxis.java    From ECG-Viewer with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Draws the major and minor tick marks for an axis that lies at the top or
 * bottom of the plot.
 *
 * @param g2  the graphics device.
 * @param state  the axis state.
 * @param dataArea  the data area.
 * @param edge  the edge.
 */
protected void drawTickMarksHorizontal(Graphics2D g2, AxisState state,
        Rectangle2D dataArea, RectangleEdge edge) {
    List ticks = new ArrayList();
    double x0;
    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();
    Line2D inside = null;
    Line2D outside = null;
    long firstOnAxis = getFirst().getFirstMillisecond();
    long lastOnAxis = getLast().getLastMillisecond() + 1;
    while (t0 <= lastOnAxis) {
        ticks.add(new NumberTick(Double.valueOf(t0), "", TextAnchor.CENTER,
                TextAnchor.CENTER, 0.0));
        x0 = valueToJava2D(t0, dataArea, edge);
        if (edge == RectangleEdge.TOP) {
            inside = new Line2D.Double(x0, y0, x0, y0 + insideLength);
            outside = new Line2D.Double(x0, y0, x0, y0 - outsideLength);
        }
        else if (edge == RectangleEdge.BOTTOM) {
            inside = new Line2D.Double(x0, y0, x0, y0 - insideLength);
            outside = new Line2D.Double(x0, y0, x0, y0 + outsideLength);
        }
        if (t0 >= firstOnAxis) {
            g2.setPaint(getTickMarkPaint());
            g2.setStroke(getTickMarkStroke());
            g2.draw(inside);
            g2.draw(outside);
        }
        // draw minor tick marks
        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 Line2D.Double(xx0, y0, xx0,
                            y0 + this.minorTickMarkInsideLength);
                    outside = new Line2D.Double(xx0, y0, xx0,
                            y0 - this.minorTickMarkOutsideLength);
                }
                else if (edge == RectangleEdge.BOTTOM) {
                    inside = new Line2D.Double(xx0, y0, xx0,
                            y0 - this.minorTickMarkInsideLength);
                    outside = new Line2D.Double(xx0, y0, xx0,
                            y0 + this.minorTickMarkOutsideLength);
                }
                if (tt0 >= firstOnAxis) {
                    g2.setPaint(this.minorTickMarkPaint);
                    g2.setStroke(this.minorTickMarkStroke);
                    g2.draw(inside);
                    g2.draw(outside);
                }
                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);
}
 
Example 6
Source File: PeriodAxis.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Draws the major and minor tick marks for an axis that lies at the top or
 * bottom of the plot.
 *
 * @param g2  the graphics device.
 * @param state  the axis state.
 * @param dataArea  the data area.
 * @param edge  the edge.
 */
protected void drawTickMarksHorizontal(Graphics2D g2, AxisState state,
                                       Rectangle2D 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();
    Line2D inside = null;
    Line2D 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 Line2D.Double(x0, y0, x0, y0 + insideLength);
            outside = new Line2D.Double(x0, y0, x0, y0 - outsideLength);
        }
        else if (edge == RectangleEdge.BOTTOM) {
            inside = new Line2D.Double(x0, y0, x0, y0 - insideLength);
            outside = new Line2D.Double(x0, y0, x0, y0 + outsideLength);
        }
        if (t0 >= firstOnAxis) {
            g2.setPaint(getTickMarkPaint());
            g2.setStroke(getTickMarkStroke());
            g2.draw(inside);
            g2.draw(outside);
        }
        // draw minor tick marks
        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 Line2D.Double(xx0, y0, xx0,
                            y0 + this.minorTickMarkInsideLength);
                    outside = new Line2D.Double(xx0, y0, xx0,
                            y0 - this.minorTickMarkOutsideLength);
                }
                else if (edge == RectangleEdge.BOTTOM) {
                    inside = new Line2D.Double(xx0, y0, xx0,
                            y0 - this.minorTickMarkInsideLength);
                    outside = new Line2D.Double(xx0, y0, xx0,
                            y0 + this.minorTickMarkOutsideLength);
                }
                if (tt0 >= firstOnAxis) {
                    g2.setPaint(this.minorTickMarkPaint);
                    g2.setStroke(this.minorTickMarkStroke);
                    g2.draw(inside);
                    g2.draw(outside);
                }
                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);
}
 
Example 7
Source File: PeriodAxis.java    From buffer_bci with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Draws the major and minor tick marks for an axis that lies at the top or
 * bottom of the plot.
 *
 * @param g2  the graphics device.
 * @param state  the axis state.
 * @param dataArea  the data area.
 * @param edge  the edge.
 */
protected void drawTickMarksHorizontal(Graphics2D g2, AxisState state,
        Rectangle2D dataArea, RectangleEdge edge) {
    List ticks = new ArrayList();
    double x0;
    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();
    Line2D inside = null;
    Line2D outside = null;
    long firstOnAxis = getFirst().getFirstMillisecond();
    long lastOnAxis = getLast().getLastMillisecond() + 1;
    while (t0 <= lastOnAxis) {
        ticks.add(new NumberTick(Double.valueOf(t0), "", TextAnchor.CENTER,
                TextAnchor.CENTER, 0.0));
        x0 = valueToJava2D(t0, dataArea, edge);
        if (edge == RectangleEdge.TOP) {
            inside = new Line2D.Double(x0, y0, x0, y0 + insideLength);
            outside = new Line2D.Double(x0, y0, x0, y0 - outsideLength);
        }
        else if (edge == RectangleEdge.BOTTOM) {
            inside = new Line2D.Double(x0, y0, x0, y0 - insideLength);
            outside = new Line2D.Double(x0, y0, x0, y0 + outsideLength);
        }
        if (t0 >= firstOnAxis) {
            g2.setPaint(getTickMarkPaint());
            g2.setStroke(getTickMarkStroke());
            g2.draw(inside);
            g2.draw(outside);
        }
        // draw minor tick marks
        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 Line2D.Double(xx0, y0, xx0,
                            y0 + this.minorTickMarkInsideLength);
                    outside = new Line2D.Double(xx0, y0, xx0,
                            y0 - this.minorTickMarkOutsideLength);
                }
                else if (edge == RectangleEdge.BOTTOM) {
                    inside = new Line2D.Double(xx0, y0, xx0,
                            y0 - this.minorTickMarkInsideLength);
                    outside = new Line2D.Double(xx0, y0, xx0,
                            y0 + this.minorTickMarkOutsideLength);
                }
                if (tt0 >= firstOnAxis) {
                    g2.setPaint(this.minorTickMarkPaint);
                    g2.setStroke(this.minorTickMarkStroke);
                    g2.draw(inside);
                    g2.draw(outside);
                }
                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);
}
 
Example 8
Source File: PeriodAxis.java    From buffer_bci with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Draws the major and minor tick marks for an axis that lies at the top or
 * bottom of the plot.
 *
 * @param g2  the graphics device.
 * @param state  the axis state.
 * @param dataArea  the data area.
 * @param edge  the edge.
 */
protected void drawTickMarksHorizontal(Graphics2D g2, AxisState state,
        Rectangle2D dataArea, RectangleEdge edge) {
    List ticks = new ArrayList();
    double x0;
    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();
    Line2D inside = null;
    Line2D outside = null;
    long firstOnAxis = getFirst().getFirstMillisecond();
    long lastOnAxis = getLast().getLastMillisecond() + 1;
    while (t0 <= lastOnAxis) {
        ticks.add(new NumberTick(Double.valueOf(t0), "", TextAnchor.CENTER,
                TextAnchor.CENTER, 0.0));
        x0 = valueToJava2D(t0, dataArea, edge);
        if (edge == RectangleEdge.TOP) {
            inside = new Line2D.Double(x0, y0, x0, y0 + insideLength);
            outside = new Line2D.Double(x0, y0, x0, y0 - outsideLength);
        }
        else if (edge == RectangleEdge.BOTTOM) {
            inside = new Line2D.Double(x0, y0, x0, y0 - insideLength);
            outside = new Line2D.Double(x0, y0, x0, y0 + outsideLength);
        }
        if (t0 >= firstOnAxis) {
            g2.setPaint(getTickMarkPaint());
            g2.setStroke(getTickMarkStroke());
            g2.draw(inside);
            g2.draw(outside);
        }
        // draw minor tick marks
        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 Line2D.Double(xx0, y0, xx0,
                            y0 + this.minorTickMarkInsideLength);
                    outside = new Line2D.Double(xx0, y0, xx0,
                            y0 - this.minorTickMarkOutsideLength);
                }
                else if (edge == RectangleEdge.BOTTOM) {
                    inside = new Line2D.Double(xx0, y0, xx0,
                            y0 - this.minorTickMarkInsideLength);
                    outside = new Line2D.Double(xx0, y0, xx0,
                            y0 + this.minorTickMarkOutsideLength);
                }
                if (tt0 >= firstOnAxis) {
                    g2.setPaint(this.minorTickMarkPaint);
                    g2.setStroke(this.minorTickMarkStroke);
                    g2.draw(inside);
                    g2.draw(outside);
                }
                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);
}